Hi, I have a jQuery ajax request for a login system. At first it worked very well. But after several attempts, he only began to show a negative answer. I checked firebug and it says the answer in my case is "Connected". But the ajax answer just shows "Not_connected". I do not know what to do :( Please help me.
This is my jquery code:
var data_str = "username="+usrn+"&password="+pwd; $.ajax({ type: "POST", url: "index.php?rnd=" + Math.random(), data : data_str, complete : function(xhr,data){ if(data == 'connected'){window.location.href = 'admin.php';} else if(data = 'not_connected'){ error_gen.html('Invalid username or password'); } alert(data); } });
AS for PHP code:
$log_result = $u_obj->login_user(); if($log_result == true) { echo 'connected'; exit; } elseif($log_result == false) { echo 'not_connected'; exit; }
source share