$(selector).load( url [,date] [,callback] )

url: Request page's url Address

date: Sent to the server key:value data

callback: Callback function at request completion , Whether the request succeeds or fails , As long as XMLHttpRequest The state of the object is 4 or complete Call when

This function sets the ajax Return the content as innerHTML Insert into selector If necessary, it can be in url Add parameters later to filter the content to be inserted

If there is date Parameters are in accordance with POST Mode sending , Otherwise, in accordance with the GET Mode sending .date The format of the data is {key1:value1,key2:value2…}

The callback function automatically passes in three parameters , They are the returned contents 、 Request status 、XMLHttpRequest object . Request status refers to the status returned by the server , instead of XMLHttpRequest Object state , Total points success、error、notmodified、timeout Four states

$.get( url [,date] [,callback] [,type] )

url: Request page's url Address

date: Sent to the server key:value data , The format is {key1:value1,key2:value2…}

callback: Callback function for loading success , That is, when the server returns the status as 200 when . Two parameters are automatically passed in , The first is the returned content , The second is the request state

type: It doesn't seem to work

This function will use GET Send data by

$.post( url [,date] [,callback] [,type] )

Usage and $.get The method is consistent , It's just that the way to send data is POST

$.getScript( url [,callback] )

For dynamic loading js Script functions

url: Of the script to load url Address

callback: The callback function after the script is loaded successfully

$.getJSON( url [,callback] )

Used to load json Functions of files

url: To load json file url

callback:json Callback function after the file is loaded successfully , Will automatically pass in a parameter, that is json object

$.ajax( opitions )

opitions For one key:value object , There are various parameters in it , Common parameters are :

url:

type:

timeout:

date:

datetype:

beforeSend:

complete:

success:

error:

Specifically jquery See reference manual , The chance of using this function should be small

$.each( objecy/array,callback )

Functions used to traverse arrays or objects , This function can only traverse one layer , To traverse multiple layers, you need to reuse

object/array: Array or object to traverse

callback: Operation function , Two parameters are automatically passed in , The first is the index of the member or array of the object , The second is the specific content

 
classification :  js

jquery Learning notes -----ajax More articles about

  1. Jquery Learning notes --ajax Delete user , Used js Native ajax

    Mainly reviewed php Of pdo Database operation , and js Of ajax, What a trouble , hope jquery Of ajax Simple point . index.php: 1 <!DOCTYPE html> 2 <html lang= ...

  2. jquery Learning notes ----ajax Use

    One .load() Load page data load(url,[data],[callback]) url: Page address loaded ,[data] Transmitted data ,[callback] Callback function when load is complete . To design a load.ht ...

  3. 20151210 Jquery Learning notes AJAX Advanced

    One . Load request stay Ajax When sending requests asynchronously , When the network speed is slow , There will be a problem of long request time . But surpasses After a certain period of time , Users will become impatient and close the page . And if you can give the user some suggestions during the request in , such as : Trying to add ...

  4. 20151205 jquery Learning notes --Ajax

    Ajax Its full name is :“Asynchronous JavaScript and XML”( asynchronous JavaScript and XML), It is not JavaScript A single technology , It's using a series of interactive networks ...

  5. jQuery Study notes Ajax Usage details

    This article mainly introduces jQuery Study notes Ajax usage , Combined with the form of examples, this paper analyzes and summarizes jQuery in ajax How to use it , Include ajax request . load . Handle . Deliver, etc , Friends in need can refer to This article gives an example of j ...

  6. jQuery Study notes jQuery Of Ajax(3)

    jQuery Study notes jQuery Of Ajax(3) 6.jQuery Of Ajax plug-in unit Source code address : https://github.com/iyun/jQueryDemo.git ------------- ...

  7. jQuery Learning notes ( One )jQuery Selectors

    Catalog jQuery The advantages of selectors Basic selector Hierarchy selector Filter selector Form selector Blog for the first time , I hope I can stick to it for a long time , Blog as a way to summarize and review . Recently I began to learn jQuery, By writing a jQue ...

  8. jQuery Learning notes

    jQuery Learning notes   One .jQuery summary      Purpose : Write Less, Do More.     Basic knowledge of :        1. Symbol $ Instead of document.getElementById( ...

  9. jQuery Learning notes ( One ): introduction

      jQuery Learning notes ( One ): introduction One .JQuery What is it? JQuery What is it? ? It's always a question in my mind : Learn from the summary of students on the Internet , It can be observed from the following aspects . Don't use JQuery When you get DOM Manipulation of text ...

Random recommendation

  1. int (*p)[10] And *p[10] The difference between

    Definition points to having 10 The pointer format of a one-dimensional array of integer elements is :int (*p)[10] , And at first I thought int (*p)[10]  It's a way to define a two-dimensional array ][],(*p)[]; p=a; /* With this definition , The pointer ...

  2. php Paging query

    get Method <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  3. nginx Set the reverb proxy implementation nginx colony

    ginx.conf: worker_processes  1; events { worker_connections  1024; } http { include       mime.types ...

  4. 1 Line code , Delete svn Folder

    quote :http://www.cnblogs.com/Alexander-Lee/archive/2010/02/23/1671905.html linux operating system : find -name .svn | ...

  5. solve Volley Request network data return data garbled

    I can refer to http://tieba.baidu.com/p/4039693566 In the past, we usually wrote as follows StringRequest request=new StringRequest(url, ...

  6. MySQL The best way to optimize performance 20+ Experience ( turn )

    today , The operation of database is becoming the bottleneck of the whole application , This is for Web The application is especially obvious . About database performance , It's not just DBA What you need to worry about , And this is me What programmers need to focus on . When we design the database table structure , For operands ...

  7. install Oracle JDK 7.0 And 8.0 for Mac OS X after Eclipse Solution to start error reporting

    start-up  Eclipse  when , Direct error The JVM shared library "/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Cont ...

  8. MyBatis And TypeHandler

    Write in college web We often encounter such a problem when we apply it , When I want to insert a piece of data , Some data is Date type , But in the database VARCHAR type , At this time, you may be silly to manually convert this data into String Type is inserted into the database ...

  9. [LeetCode] Shortest Completing Word The shortest complete word

    Find the minimum length word from a given dictionary words, which has all the letters from the strin ...

  10. docker mysql Master master synchronization

    Forward from :https://blog.csdn.net/money9sun/article/details/85099134 First step : install docker   https://www.cnblogs.com/ ...