Strange behaviour with WAMP and an Ajax query
I'm currently trying to run a script which works on my LAMP environment
but not on a WAMP environment :
$.ajax(
{
url: '<?php echo ROOT_DIR;?>/member/login-process',
type: "post",
data: $('form').serialize(),
success: function(data)
{
if (data == 'success')
{
setTimeout(function(){window.location.href = '<?php
echo ROOT_DIR;?>/dashboard';}, 2000);
}
else
{
$("#alert").html('<div class="alert alert-error"><i
class="icon-exclamation-sign"></i> '+data+'</div>');
}
}
});
When I try it on LAMP, it works fine: i'm redirected. With WAMP, I don't
know why, but I have the following error message (generated by the
"else"):
success
I've tried typeof(data) and I have "string" as result. The value returned
by the Ajax query is therefore the "success" string, so Why the "if" is
ignored?
No comments:
Post a Comment