Skip to content

Instantly share code, notes, and snippets.

@ajace
Created January 15, 2014 19:22
Show Gist options
  • Save ajace/8442619 to your computer and use it in GitHub Desktop.
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
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