I can't figure out why this Ajax script isnt working.
Heres the code:
$(document).on('submit', '.edit_user', function(){
console.log('submit');
$.post
(
$(this).attr('action'),
$(this).serialize(),
function(data){
console.log("data");
console.log(data);
$('#edit_first_name').val(data['first_name']);
},
"json"
);
return false;
});
I have the submit
show up in the console so I know the .post
is called. I also know it makes it to the return false
because the form never submits and redirects.
However, it never console.log(data)
.
I'm pretty sure all this is because I'm forgetting something simple.