Detailed analysis of how to use AJAX (code pasted)

亚连
Release: 2018-05-18 09:30:15
Original
1763 people have browsed it

The following is the method of using AJAX that I have compiled for you. Interested students can take a look.

HTTPS

"/jsontest/randomdata/" // there was a missing trailing /// i.e. // was going to https://larsendt.com/jsontest/randomdata/?ymax=500&count=32&t=0.96041791105086431234
Copy after login

GET request

  新建网页     

ajax之get形式请求

用户名:

密码:

12345678910111213141516171819202122232425262728293031323334353637
Copy after login

POST request

  新建网页     

ajax之post形式请求

用户名:

密码:

123456789101112131415161718192021222324252627282930313233343536373839404142
Copy after login

FormDate collects form data

   

用户名:

密 码:

邮 箱:

头 像:

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
Copy after login

AJAX cross-domain

//放在被访问资源上  12
Copy after login

jasonP

//在客户端定义函数,在服务端定义调用函数和传入参数,请求时传入调用参数内容,服务端就用客户端传入的函数名为调用函数名(可变函数); // https://xxx.cc.com/xx.php?param=xxx&function_name=function_name//百度标准接口 https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=法国大选&cb=demo12345
Copy after login

JQUERY AJAX

Syntax :
$.get(url,data,function(),dataType)
url: Requested file.
data: Pass data.
function(responseText, statusText,xhr): Return function.
responseText: Returned text.
statusText: The returned status value.
status contains the status of the request
("success", "notmodified", "error", "timeout", "parsererror")
xhr: XMLHttpRequest() request object.
datatype:
"xml" - an XML document
"html" - HTML as plain text
"text" - a plain text string
"script" - runs the response in JavaScript and Returns
"json" as plain text - runs the response as JSON and returns it as a JavaScript object
"jsonp" - loads a JSON chunk using JSONP, which will add a "?callback=?" to the URL to specify the callback

.get(),.get(),.post() //post is the same as get parameters

JQuery Collapse  
用户名:
密码:
1234567891011121314151617181920212223242526272829303132333435363738394041
Copy after login

$.ajax()

JQuery Collapse  
用户名:
密码:
Copy after login

The above is what I compiled I hope everyone’s tips on how to use AJAX will be helpful to you in the future.

Related articles:

Detailed explanation of the steps for jQuery ajax to call WCF service

jQuery AJAX timeout timeout emergency handling method

JQuery AJAX implementation file download

The above is the detailed content of Detailed analysis of how to use AJAX (code pasted). For more information, please follow other related articles on the PHP Chinese website!

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