Hi All,
I have a problem with Ajax Submit Can anyone please help??
I am using a jquery window with sliding divs for three options new user signup, login and ignore
When the user selects the login the following code has to be executed.
Everything works fine. but after the submit i am not getting the response from Process.php back
Can anyone help me
Urgent help required!!!
// This is my Javascript where i am calling the submit
$(document).ready(function() {
$(‘#frmsignin’).submit( submitForm );
}
function submitForm() {
var signinform = $(‘#dialog1’);
var signin = $(this);
// Are all the fields filled in?
if ( !(document.getElementById(“email”).value || !document.getElementById(“pass”).value )) {
// No; display a warning message and return to the form
$('#incompleteMessage').fadeIn().delay(messageDelay).fadeOut();
signinform.fadeOut().delay(messageDelay).fadeIn();
} else {
// Yes; submit the form to the PHP script via Ajax
var strPost = signin.serialize();
$('#sendingMessage').fadeIn();
signinform.fadeOut();
$.ajax({
url: "/Process.php",//signin.attr( 'action' ) ,//+ "?ajax=true",
type: "POST",
data: $strPost,
success: submitFinished
});
}
// Prevent the default form submission occurring
return false;
}
// Handle the Ajax response
function submitFinished( response ) {
$response = $.trim( response );
alert($response);
$(‘#sendingMessage’).fadeOut();
if ( $response == “success” ) {
// Form submitted successfully:
// 1. Display the success message
// 2. Clear the form fields
// 3. Fade the content back in
$('#successMessage').fadeIn().delay(messageDelay).fadeOut();
$('#email').val( "" );
$('#pass').val( "" );
$('#content').delay(messageDelay+500).fadeTo( 'slow', 1 );
} else {
// Form submission failed: Display the failure message,
// then redisplay the form
$('#failureMessage').fadeIn().delay(messageDelay).fadeOut();
$('#dialog1').delay(messageDelay+500).fadeIn();
}
}
});
Thanks and Regards