[jQuery] AJAX return value
Hello, I have a page which shows items in a list. I want to call jQuery.ajax and in the return have either: A fail response with a failure string or A success response, a success string, and a bit of HTML to replace the old item on my page. What's the best way to send both a response string and a bit of page update HTML?
[jQuery] Re: AJAX return value
Thanks for the quick reply! What would the format of the html be? Like this? 1divreturnstuff/div On Jun 3, 11:36 pm, Gustavo Salomé gustavon...@gmail.com wrote: try this: $.ajax({ url:'mypage.php', data:'item1=1item2=2', success:function(html){ if(html.substr(0,1)==1){ $('#divToUpdate').html(html.substr(1)); } else{ alert('error page'); } } }); 2009/6/4 Dave Roberts dave.a.robe...@gmail.com Hello, I have a page which shows items in a list. I want to call jQuery.ajax and in the return have either: A fail response with a failure string or A success response, a success string, and a bit of HTML to replace the old item on my page. What's the best way to send both a response string and a bit of page update HTML? -- Gustavo Salome Silva
[jQuery] Form Plugin data return type
Hello, I'm trying to submit a form via Ajax and receive a JSON return type http://imgur.com/2KZ1.png As you can see in the screen shot, I call the method ajaxForm, and on success of the ajax call, processJson is being invoked. This method only outputs a data.message alert. For some reason, the message is always undefined. I am showing a screen shot of my Firebug debugging, showing that the variable data is indeed populated with the data I have. What am I missing?
[jQuery] form objects and the DOM
Hello. I am building a webform which will be used to enter the names of people, then hit a submit button to send the data to the server. I have a button which uses jquery to append input fields to the form on the fly. Hit the button, get another text input field. These input boxes are correctly attaching themselves as children of the #names div. My #names div is inside of my form in my HTML file: form div id=names/div /form But firebug is always putting my form in a table at the end of my dom, leaving the text inputs which are appended outside of this form, therefore not being given to the server when the form has been submitted. Can anybody point out to me why?