Thinkphp: click the button and process the background action. What should I do? How to respond to this button ?, Please give me a great answer .. Thinkphp: click the button and process the background action. What should I do? How to respond to this button ?, Please give me a great answer ..
Reply content:
Thinkphp: click the button and process the background action. What should I do? How to respond to this button ?, Please give me a great answer ..
It is more convenient to use the link, so that the href OF a points to the path where you want to execute the action, and the parameters can be spelled on the url. If it is complicated, ajax will be used for the request, the principle is the same. Of course, the biggest advantage of ajax is that the page does not jump/refresh
The button triggers a request, which is similar to the request for opening a webpage. Therefore, the backend processes the request normally. (I suggest you post the code to let us know if you want ajax requests or page requests)
Use ajax to request the url of the backend action to perform the operation
After successful callback, you can use js to call back the data returned by the backend.