Skip to content

Instantly share code, notes, and snippets.

@vumanhcuongit
Last active December 12, 2015 02:58
Show Gist options
  • Save vumanhcuongit/4702502 to your computer and use it in GitHub Desktop.
Save vumanhcuongit/4702502 to your computer and use it in GitHub Desktop.
$('form#new_task').submit(function() {
$.ajax({
type: "POST",
url: $(this).attr('action'), //sumbits it to the given url of the form
data: {
data_1: value_1,
data_2: value_2
}, //input gui di
dataType: "HTML",
success(function(result){
// result la gia tri tra ve tu controller
//do something
});
});
return false; // dung cho muc dich ko chuyen trang
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment