$.post('http://mobile.alicante-intermedia.com/submit_contact.php', { // These are the names of the form values FirstName: $('#FirstName_input').val(), LastName: $('#LastName_input').val(), Email: $('#Email_input').val(), MessageText: $('#MessageText_input').val() // HTML function }, function (html) { // Place the HTML in a astring var respOnse=html; // PHP was done and email sent if (respOnse=="success") { alert("Message sent!"); } else { // Error postback alert("Please fill all fields!"); return false; } });
// When the document has loaded... $(document).ready(function() { // Bind this action as a function to be executed when the button is clicked... $('input[type="button"][value="submit contact"]').click(function() { $.post('http://mobile.alicante-intermedia.com/submit_contact.php', { // These are the names of the form values // EDIT: You have the wrong ids on these... FirstName: $('#txtfullname').val(), LastName: $('#txtemail').val(), Email: $('#txtcontact').val(), MessageText: $('#txtmessage').val() // HTML function }, function (html) { // Place the HTML in a astring var respOnse=html; // PHP was done and email sent if (respOnse=="success") { alert("Message sent!"); } else { // Error postback alert("Please fill all fields!"); return false; } }); }); });