Last active
June 7, 2018 06:22
-
-
Save FabianSchmick/65f29c1ac70d4fe05897bc2f5513ed33 to your computer and use it in GitHub Desktop.
Ajax form skeleton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#idForm").on('submit', function (e) { | |
$.ajax({ | |
type: $(this).attr('method'), | |
url: $(this).attr('action'), | |
data: $(this).serialize() | |
}).done(function(data) { | |
console.log(data); | |
}).fail(function(XMLHttpRequest, textStatus, errorThrown) { | |
console.log('Error'); | |
}); | |
e.preventDefault(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment