Created
March 14, 2013 11:55
-
-
Save psdtohtml5/5160807 to your computer and use it in GitHub Desktop.
jQuery : Ajax Request
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
$("#contact-form").submit(function(e) { | |
e.preventDefault(); | |
var name = $("#name").val(), | |
email = $("#email").val(), | |
subject = $("#subject").val(), | |
message = $("#message").val(); | |
$.ajax({ | |
type: "POST", | |
url: "contact.php", | |
data: { | |
submit: true, | |
name: name, | |
email: email, | |
subject: subject, | |
message: message | |
}, | |
beforeSend: function ( xhr ) { | |
$("#status").show().html("<img src='images/preloader.gif' width='32' height='32' alt='sending email...'>"); | |
} | |
}).done(function( response ) { | |
$("#status").html(response); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment