Skip to content

Instantly share code, notes, and snippets.

@Yelakelly
Created March 24, 2016 17:52
Show Gist options
  • Save Yelakelly/62009c8e1da75c1a73d8 to your computer and use it in GitHub Desktop.
Save Yelakelly/62009c8e1da75c1a73d8 to your computer and use it in GitHub Desktop.
$('.js-send-form').submit(function(e){
var postData = $(this).serializeArray();
var formURL = $(this).attr('action');
$.ajax(
{
url: formURL,
type:"POST",
data:postData,
success:function(data)
{
alert('Форма успешно отправлена!');
},
error:function()
{
alert('Ошибка! Попробуйте позже.')
}
});
e.preventDefault();
});

Send form via ajax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment