Implementation example of ThinkPHPJQueryAjax

Source: Internet
Author: User
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:




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.