Could you tell me how the variables passed by php to js cannot be judged to use the ajax callback function? when the value sent by php is = 1, when the js alert succeeds, the js alert fails at 2?
However, when the callback function determines msg = 1, alert fails no matter what js value is sent.
Js .......................
$ (Document ). ready (function () {$ ("# login "). bind ("mouseover", login); function login () {var name = $ ("# username "). val (); var password = $ ("# password "). val (); var param = {"name": name, "password": password}; if (name = "") {alert ("Warning! Illegal access, username is blank "); return false;} else {if (password =" ") {alert (" Warning! Illegal access, password blank ") return false;} else {$. ajax ({type: "post", url: "http: // localhost/kkc/login. php ", data: param, success: function (msg) {if (msg = 1) {alert (" successful ");} else {alert ("failed ");}}});}};};});
Reply to discussion (solution)
It should be the impact of the BOM header.
Echo base64_encode (file_get_contents ('http: // localhost/kkc/login. php '));
Post result
Use chrome to check what the php file returns and see if there are any other problems.
Echo base64_encode (file_get_contents ('http: // localhost/kkc/login. php '));
How can I solve the problem after posting the results...
You have not done what I want!
How can I give you the next step?
Do you want me to fool you ???
You have not done what I want!
How can I give you the next step?
Do you want me to fool you ???
I have removed the bom header. how can I do it next? I am the first time I did java, but I don't understand php...
Isn't there require ("mysql. php?
Is the BOM header removed from mysql. php?
Java is not a shield, because it is basic knowledge.
Isn't there require ("mysql. php?
Is the BOM header removed from mysql. php?
Java is not a shield, because it is basic knowledge.
Okay, but no such issues have occurred in the j2ee project.
Success: function (msg ){
Alert (msg); // check what is prompted
If (msg = 1 ){
Alert ("successful ");
} Else {
Alert ("failed ");
}
Success: function (msg ){
Alert (msg); // check what is prompted
If (msg = 1 ){
Alert ("successful ");
} Else {
Alert ("failed ");
}
If the account is correct, 1 Fails. 2