Skip to content

Instantly share code, notes, and snippets.

@alexdev27
Created April 4, 2017 00:19
Show Gist options
  • Save alexdev27/7a3c496ad76be2402c2435a2a82fd439 to your computer and use it in GitHub Desktop.
Save alexdev27/7a3c496ad76be2402c2435a2a82fd439 to your computer and use it in GitHub Desktop.
ajax func
function ajaxForm(form, urlToFile) {
// if (!valid) {return false;}
var serailizedForm = form.serialize();
var result = $.ajax({
url: urlToFile,
type: 'post',
// dataType: 'json',
data: serailizedForm,
}).fail(function(answerFromServer){
alert('AJAX FAIL ');
});
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment