Question : Post data back to jquery

Hello again Experts,

I'm working on a page, where I use the ajax method of jquery. On the page there is a select list where there is an option: "Add new element". When the user clicks on this item a small fancybox comes up where the user can type the name of the new element. Clicking the submit the data will be saved.

My problem is the following:
The user gives infos into the form, than submit it. The jquery calls a php file which stores the data into database.
Is it possible that the php sends datas back to jquery? I need the id of the last inserted row, because I'd like to attach to the new element to the existing select list.

Or any other way to this?

Thank you very much!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
$.ajax({
                        type: "POST",
                        url: "root/to/file.php",
                        data: dataString,
                        success: function()
                        {
                            $('#addshipping').hide();
                            $('#success').fadeIn(1000,function()
                            {
                                parent.$.fancybox.close();
                            });
                        }
                    })

Answer : Post data back to jquery

Sure try this
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
$.ajax({ 
                        type: "POST", 
                        url: "root/to/file.php", 
                        data: dataString, 
                        success: function(data) 
                        { 
                            alert(data);
                            $('#addshipping').hide(); 
                            $('#success').fadeIn(1000,function() 
                            { 
                                parent.$.fancybox.close(); 
                            }); 
                        } 
                    })
Random Solutions  
 
programming4us programming4us