Figure 1
Figure 2
Figure 3
In the message input box in Figure 1 after entering the mailbox, through the JS file in Figure 2 to pass the mailbox information to the PHP file in Figure 3, figure 3 of the database operation is always error, no database operation Yes, do not know why
Reply content:
Figure 1
Figure 2
Figure 3
In the message input box in Figure 1 after entering the mailbox, through the JS file in Figure 2 to pass the mailbox information to the PHP file in Figure 3, figure 3 of the database operation is always error, no database operation Yes, do not know why
1. Use Ajaxreturn instead of Echo
2, True and false to return the result as a string, which is "true", "false"
3, the result of the return through Ajax is a string , can not be directly judged by the IF, but should use = = to judge, otherwise always for if (response) has always been true, so the return of the existing
=======================
Modify the answer
First you have to have a good understanding of the MVC model before you can use thinkphp correctly.
1, thinkphp logic is/controller/method,
Suppose your module name is index (it should look like this from your project directory)
where($where)->find()){ $this->ajaxReturn(true); }else{ $this->ajaxReturn(false); } }}
Then your post code should write this, the location should be in the Thinkphp view folder
$.post("/Login/verify",{loginEmail:loginEmail}, function(response){ ...}
Return results with Ajaxreturn
False and true replace with ' false ' and ' true ' try
$.post (URL, data, function, ' josn ')