why does the data property in an jquery ajax call override my return false?
Posted
by user315709
on Stack Overflow
See other posts from Stack Overflow
or by user315709
Published on 2010-04-13T16:59:20Z
Indexed on
2010/04/13
17:03 UTC
Read the original article
Hit count: 113
JavaScript
|jquery-ajax
hi,
i have the following block of code:
$("#contact_container form, #contact_details form").live(
"submit",
function(event) {
$.ajax({
type: this.method,
url: this.action,
data: this.serialize(),
success: function(data) {
data = $(data).find("#content");
$("#contact_details").html(data);
},
});
return false;
}
;
when i leave out the data: this.serialize(), it behaves properly and displays the response within the #contact_details div. however, when i leave it in, it submits the form, causing the page to navigate away. why does the presence of the data attribute negates the return false? (probably due to a bug that i can't spot...)
also, is the syntax to my find statement correct? it comes back as "undefined" even though i use a debugger to check the ajax response and that id does exists.
thanks, steve
© Stack Overflow or respective owner