Consider the following code:
$('.saveCheck').on('click',function()
{
var frm = $(this).parents('form');
frm.submit(function (ev)
{
$.ajax
({
type: frm.attr('method'),
url: frm.attr('action'),
data: frm.serialize(),
success: function (data)
{alert("hooray!");}
});
ev.preventDefault();
});
});
This will not submit my form, however:
frm.submit();
On its own works fine, but wont have any of the AJAX goodness.
Is there any glaringly obvious reason for this?