http://jsfiddle.net/QsTfc/
For some odd reason the form keeps submitting even though I am returning false. I have tried:
$(\"#submitEdit\").submit(functi
According to your jsfiddle demo your form is added dinamically. So, you have to use delegation:
$(document).on("submit", "#submitEdit", function() {
var url = $(this).attr('action');
var data = $(this).serialize();
alert(data);
$.post(url, data, function(returned) {
$(parentId + "Field").html(returned);
return false;
});
return false;
});
JSFIDDLE
you need to put your event parameter in your call back function
$("#submitEdit).submit(function(event) {
event.preventDefault();
});
and try this:
$(document).on("submit", "#submitEdit", function(event) {
event.preventDefault();
var url = $(this).attr('action');
var data = $(this).serialize();
alert(data);
$.post(url, data, function(returned) {
$(parentId + "Field").html(returned);
return false;
});
});
when to use return false and when to use event.preventDefault(). you can take a look for this question: When should I use return false in jquery function?