Skip to content

Instantly share code, notes, and snippets.

@aslamdoctor
Created February 6, 2012 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslamdoctor/1750888 to your computer and use it in GitHub Desktop.
Save aslamdoctor/1750888 to your computer and use it in GitHub Desktop.
jQuery Ajax call
$.ajax({
type: "POST",
url: "submit_ops.php?action=submit_form",
data: $( "#frmMyForm" ).serialize(),
success: function(result){
if(result=='Success'){
$("#msgContainer").html('<div style="color:#3CA322;font-weight:bold;font-size:14px;padding:10px;">Thank you.</div>');
$("#msgContainer").fadeIn();
}
else{
$("#msgContainer").html('<div style="color:red;font-size:12px;padding:10px;">' + result + '</div>');
$("#msgContainer").fadeIn();
}
},
error: function(){
//console.log('error');
},
complete: function(){
//console.log('complete');
$(".loading_msg").fadeOut();
$("#submit").attr("disabled", false);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment