In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how Ajax implements asynchronous submission of classes and supports cross-domain. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The code is as follows:
/ *
Asynchronous request class
Author: I am not unintentional
Creation time: 2009.2
-
Modify the record:
2009.4.27Mel-add URL detection, if it is "http://xxxx.xxx.xx.xx/.." This format can be obtained using the "/ getUrl.aspx" provided by the system.
To solve cross-domain problems.
There are two main parameters of getUrl.aspx: 1. The url value is the target URL (you can have parameters in URL)-- must be; 2. The method value is the method used by the agent (optional)
If method is empty, the POST method is used by default; if the FORM parameter is empty (that is, request.content-length=0), it is automatically set to the GET method
(note: getUrl.aspx redesigned on April 27, 2009, adding a Cookie agent on the basis of the original completed agent.)
, /
Function IsOuterURL (str_url) {
Var strRegex = "((https | http): / / ([\\ w -] +\\.) + [\\ w -] +. ([^ aMaiz]) (/ [\\ wlash% yield =] *)? | ((https | http): / / [a-zA-Z0-9\\ -\.] [\\ w -] +. ([^ aripz]) (/ [\\ w.Universe% yield =] *)?"
Var re=new RegExp (strRegex)
If (re.test (str_url)) {
Return (true)
} else {
Return (false)
}
}
Var LeesAjaxRequest=
{
List: []
M_LeesAjaxHttpRequest:null
IsWorking:false
GetUrl:function (method,url,params,successFun,FailureFun,headers)
{
If (url.length0)
{
Var o=_this.list [0]
_ this.list.splice (0Pol 1)
_ this.getUrl (o.methodmethod o.urlrecovero.paramsauthoro.recording Funauthoro.failureFunauthoro.headers)
}
}
}
Var vPara= ""
If (typeof params== "string")
{
VPara=escape (params)
}
Else if (params)
{
Try
{
For (var e in params)
{
If (vPara.length
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.