The ThinkPHP framework is completely isolated from the client without any dependencies, and the ajaxReturn method returned by the server is also common. ThinkPHP JQuery Ajax
The ThinkPHP framework is completely isolated from the client without any dependencies, and the server returns ajaxReturn
Methods are also common. In ThinkPHP Ajax usage details and examples, the ThinkAjax class library combines prototyep and mootools
. In fact, you can use any Js class library to implement ThinkPHP Ajax. This article uses JQuery to implement ThinkPHP Ajax
Use the same features in the document "details and examples.
Js class library
To use ThinkPHP JQuery Ajax, You need to load the Js
Class Libraries include:
Href = "_ PUBLIC _/Js/Jquery/jquery. form. js"/>
(Jquery. form. js class library is
The JQuery plug-in is used to simplify the ajax interaction of forms. You can decide whether to load the form based on the actual situation.
These Js class libraries can be found in ThinkPHP 2.1
This is obtained under the Public/Js/Jquery official example of the version. The instance code download package is also provided in this section. Make sure that the above Js is correctly loaded before Ajax testing.
Class Library.
AJAX return
Use the ajaxReturn and success/error Methods to return data.
About
For details about how to return the ajaxReturn method, see ThinkPHP Ajax usage and examples. For details about how to return success/error, see ThinkPHP
The success/error method returns Ajax information.
ThinkPHP JQuery Ajax instance
Example function and ThinkPHP
For details about Ajax usage and examples, click the "check user name" button to check whether the user name meets the requirements and click "Submit"
The button returns different information based on the user name entered.
Html file
Public/loginJauery.html template, Js processing function and form
Form: