1. ajax is used in the project. Results during the test, the page was found to be different in the two browsers: The 360 browser can successfully achieve the pop-up window (alert) effect, but the Firefox browser has no effect at all. But they all share a common feature: in the browser's debugging mode (F12) network option xhr...
1. ajax is used in the project. Results during the test, the page was found to be different in the two browsers: The 360 browser can successfully achieve the pop-up window (alert) effect, but the Firefox browser has no effect at all. However, they all share a common feature: No data is obtained under the xhr network option of the browser's debugging mode (F12, data, including index homepage (POST), can be seen in all parts of the network, such as html, css, and js. Other resources are obtained by GET.
2. if ThinkPHP's automatic verification function is used, the error will automatically return information, including no user name or password, but I did not compare the account and password, I also don't know why I lost data randomly in the user name and password in the 360 browser. I found a blank alert dialog box, and I don't know what the problem is?
3.360 when the alert dialog box appears in the browser, xhr still has data, but when you click OK in the alert dialog box, the xhr data disappears.
The code is as follows:
(1) login. js
// Front-end login service class var login = {checkUser: function () {// Obtain the input data in the logon page var userName = $ ('input [name = "username"] '). val (); var userPass = $ ('input [name = "userpass"] '). val (); // use ajax var url = "/stfjzd-15/index. php/Home/Index/checkUser "; var data = {" username ": userName," userpass ": userPass}; $. post (url, data, function (result) {// $ ("# result" ).html (data.info ). show (); // $ ("# result "). fadeOut (4000); if (result. status) {alert (result.info);} else {// alert (2); alert (result.info) ;}}, "json ");}}
(2) IndexController. class. php
Display ();} // user verification public function checkUser () {// receives the variable. the default htmlspecialchars filter $ userName = I ("post. username "); $ userPass = I (" post. userpass "); $ User = D (" Stuser "); // automatic verification of ThinkPHP must use create () to enable if (! $ User-> create () {return $ this-> error ($ User-> getError (); // exit ($ User-> getError ());}} // empty operation public function _ empty () {echo "the page does not exist. check whether the path you entered is correct. I want to return to the homepage ";}}
(3) StuserModel. class. php
DB = M ("Stuser");} // the form of ThinkPHP automatically verifies protected $ _ validate = array ("username", "require ", "username cannot be blank"), array ("userpass", "require", "password cannot be blank"),) ;}?>
Reply content:
1. ajax is used in the project. Results during the test, the page was found to be different in the two browsers: The 360 browser can successfully achieve the pop-up window (alert) effect, but the Firefox browser has no effect at all. However, they all share a common feature: No data is obtained under the xhr network option of the browser's debugging mode (F12, data, including index homepage (POST), can be seen in all parts of the network, such as html, css, and js. Other resources are obtained by GET.
2. if ThinkPHP's automatic verification function is used, the error will automatically return information, including no user name or password, but I did not compare the account and password, I also don't know why I lost data randomly in the user name and password in the 360 browser. I found a blank alert dialog box, and I don't know what the problem is?
3.360 when the alert dialog box appears in the browser, xhr still has data, but when you click OK in the alert dialog box, the xhr data disappears.
The code is as follows:
(1) login. js
// Front-end login service class var login = {checkUser: function () {// Obtain the input data in the logon page var userName = $ ('input [name = "username"] '). val (); var userPass = $ ('input [name = "userpass"] '). val (); // use ajax var url = "/stfjzd-15/index. php/Home/Index/checkUser "; var data = {" username ": userName," userpass ": userPass}; $. post (url, data, function (result) {// $ ("# result" ).html (data.info ). show (); // $ ("# result "). fadeOut (4000); if (result. status) {alert (result.info);} else {// alert (2); alert (result.info) ;}}, "json ");}}
(2) IndexController. class. php
Display ();} // user verification public function checkUser () {// receives the variable. the default htmlspecialchars filter $ userName = I ("post. username "); $ userPass = I (" post. userpass "); $ User = D (" Stuser "); // automatic verification of ThinkPHP must use create () to enable if (! $ User-> create () {return $ this-> error ($ User-> getError (); // exit ($ User-> getError ());}} // empty operation public function _ empty () {echo "the page does not exist. check whether the path you entered is correct. I want to return to the homepage ";}}
(3) StuserModel. class. php
DB = M ("Stuser");} // the form of ThinkPHP automatically verifies protected $ _ validate = array ("username", "require ", "username cannot be blank"), array ("userpass", "require", "password cannot be blank"),) ;}?>
Use$this->ajaxReturn()
Orjson_encode
Try