Created
January 15, 2014 19:22
-
-
Save ajace/8442619 to your computer and use it in GitHub Desktop.
ajax form submittal using jquery; useful inside of iframes since .submit() doesn't work
This file contains 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
var url = location.origin; | |
var form = $('').serialize(); | |
$.ajax({ | |
url: url, | |
type: 'post', | |
dataType: 'json', | |
data: form, | |
}).done(function(data){ | |
console.log("success"); | |
}).fail(function(){ | |
console.log("There was an error."); | |
console.log(data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment