Home > Web Front-end > JS Tutorial > Example analysis of the difference between native Ajax and jQuery Ajax_jquery

Example analysis of the difference between native Ajax and jQuery Ajax_jquery

WBOY
Release: 2016-05-16 16:25:47
Original
932 people have browsed it

Preface: This time I introduce a small example of using ajax to exchange data with the background, so the demo must be opened through the server. The server environment is very easy to set up. Just download wamp or xampp from the Internet, install it step by step, and then put the written page in the specified location on the server. When opening, enter "localhost/specified page" or "127.0.0.1/specified page" in the browser address bar to open it.

The demo’s HTML, PHP, native ajax, and jq ajax codes are listed below.

HTML code:

Copy code The code is as follows:




ajax example






         

                                                                                                                                                                                                                                                                                                                                                               in                                                                                                                                                                                                                                                                       in                                                                                                                                                                                                                     in                                                                                                                                                                                                                    
  • winter

  •                                                   
                                                                                                      

               
                                                                                           







    PHP code:


    Copy code

    The code is as follows: $details = array ( 'spring' => 'summer' => "

    The crystal curtain moved in the breeze, and the roses filled the courtyard with fragrance

    ",
    'fall' => "

    The autumn leaves of Jinjing sycamore are yellow, and the bead curtains are not rolled up by the frost at night

    ",
    'winter' => "

    The plum blossoms are as white as the snow, but the snow is less fragrant than the plum blossoms

    "
    );
    echo $details[$_REQUEST['LiName']];
    ?>

      原生ajax:

    复制代码 代码如下:


      JQ ajax:

    复制代码 代码如下:


    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template