I am not sure why this is happening, but the second jQuery call is giving a 500 error. Is that because nested calls are not allowed? Or something else? Thanks! Below is the whole code:
<script type="text/javascript" >
$(function()
{
$('#add_comment').bind('submit',function()
//$("input[type=submit]").click(function()
{
var problem_id = $("#problem_id").val();
var problem_comment = $("#problem_comment").val();
var dataString = 'problem_id='+ problem_id + '&problem_comment=' + problem_comment;
if( problem_id == '' || problem_comment == '' )
{
$('.comment_success').fadeOut(200).hide();
$('.comment_error').fadeOut(200).show();
}
else
{ alert ("2");
// Now check if the person is logged in.
$.ajax({
type: "POST",
url: "/auth/check_login.php",
dataType: "json",
success: function(data)
{
alert ("3");
// Now add the comment!
$.ajax({
type: "POST",
url: "/problems/add_problem_comment_ajax.php",
dataType: "json",
data: dataString ,
success: function(data)
{
$('.add_message_success').fadeIn(200).show();
$('.add_message_error').fadeOut(200).hide();
// Here can update the right side of the screen with the newly entered information
alert ("success");
},
error: function(data)
{
alert ("error");
}
});
},
error: function(json)
{
alert ("error 2");
$("#loginpopup").dialog();
return false;
}
});
}
return false;
});
});
</script>
It should be a bug in this script: “/problems/add_problem_comment_ajax.php”. You should check the error log to see the detailed error. The error log could be in the following places if you are using unix/linux/mac:
/var/log/httpd-error.log,/var/log/apache2/error_log. If it’s Windows, you should be able to view it in the event viewer.