[eluser]Unknown[/eluser]
Hi, hopefully this doesn't turn out to be something stupid - but i'm getting desperate.
Recently, I added a jquery modal login box to my site. Everything works correctly until I submit the form - i receive: POST
http://www.mydomain.com/auth/login [HTTP/1.1 500 Internal Server Error 40ms]
To keep things simple, I just have the method echoing "OK". Nothing shows up in the log files.
Note: if i change "url:" in the js file to test.php and just put "echo 'OK';" in the test file, it works...
Any help would be greatly appreciated!
init.js
Code:
// When DOM is ready
$(document).ready(function(){
// When the form is submitted
$("#login-box > form").submit(function(){
// Hide 'Submit' Button
$('#sign-in').hide();
// Show Gif Spinning Rotator
$('#ajax_loading').show();
// 'this' refers to the current submitted form
//var str = $(this).serialize();
var form_data = {
username: $('#username').val(),
password: $('#password').val()
};
// -- Start AJAX Call --
$.ajax({
type: "POST",
url: "http://www.mydomain.com/auth/login", // Send the login info to this page
data: form_data,
success: function(msg){
$("#login-box").ajaxComplete(function(event, request, settings){
// Show 'Submit' Button
$('#submit').show();
// Hide Gif Spinning Rotator
$('#ajax_loading').hide();
if(msg == 'OK') // LOGIN OK?
{
var login_response = '<div id="logged_in">' +
'<div>' +
'<div>' +
'<img align="absmiddle" src="./images/ajax-loader.gif">' +
'</div>' +
'<div>'+
"You are successfully logged in! <br /> Please wait while you're redirected...</div></div>";
//$('a.modalCloseImg').hide();
$('#simplemodal-container').css("width","500px");
$('#simplemodal-container').css("height","120px");
$(this).html(login_response); // Refers to 'status'
// After 3 seconds redirect the
setTimeout('go_to_private_page()', 3000);
}
else // ERROR?
{
var login_response = msg;
$('#login_response').html(login_response);
}
});
}
});
// -- End AJAX Call --
return false;
}); // end submit event
});
function go_to_private_page()
{
[removed] = 'http://www.mydomain.com/my_crib'; // Members Area
}