0
[SOLVED] How to Refresh page in AJAX
If(data ==“Yes”){ location.reload(); }else { alert(“username/password is incorrect ”); } When the data is true Ajax not refresh the page ???
5 ответов
+ 2
Ahmad Al-Zreqat There maybe many possibilities of this problem.
1 - are you getting Yes in response.
2 - if yes then what type of response you are getting like as an object or as a String.
3 - if you are getting as an object then data == "Yes" will not work.
Except these points I am not getting any problem because location.reload() always works.
To Debug this you need to check response type and you can also print on console inside if condition.
+ 2
Ahmad Al-Zreqat Try to print data == "Yes" and Check what you get true or false
+ 1
Ahmad Al-Zreqat Are you getting Yes in response?
0
yes
when i input faild data the alert is shown but when im input right data no refresh no alert
so the proplem why no action when i input right data
and i use event.preventDefault();
but when i removed the ajax not work correctly
AJ #Infinity Love
0
when im checked network code status with true value is given
302 Found (no refresh page ,no errors)
with wrong value 200 OK (error shown)