Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand AJAXCALL

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the relevant knowledge of "how to understand AJAXCALL". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Download V0.1.6 (5KMAE 2007.1.16) |

Syntax: AJAXCALL (url,handleResponse,param); give the callback data to handleResponse for processing

Parameter: url: requested address; handleResponse: callback function; doc: the document returned by AJAX; param: additional parameter (isCache: whether cache is required, default is not cached; isXML: whether to return XML document, default HTML;method: send method, default GET;attach: extension parameter, you can pass custom values, such as id of DIV, etc.)

Example 1:

AJAXCALL ("gaogao.xml", "doPostXml", "method=POST, isXML=true, isCache=true,attach=showContent")

Function doPostXml (doc,id) {

Alert (doc) / / get the returned XML document

Alert (id) / / extension parameter, the value of attach, "showContent"

If (doc) {

$(id) = getTagValue (doc,retcode)

}

}

Example 2:

AJAXCALLl ("getnews?pid=23412", "shownews", "attach=" + $('yoyo'))

Function shownews (docu,divObject) {

If (docu) {

DivObject.innerHTML=docu

} else {

DivObject.innerHTML= "system error"

}

}

Note:

If POST data, encode the data and add it to the URL, for example:

AJAXCALL ("gaogao.php?name=" + $U ('yo') + "& sex=" + male, "yoyo2", "method=POST")

AJAXFORM

Syntax: AJAXFORM (formID,handleResponse,param); AJAX POST the form data out

Parameter: formID: form ID;handleResponse: callback function, doc returns document for AJAX; param: additional parameter (isXML: whether to return XML document, default HTML;attach: extension parameter, custom value can be passed, such as DIV id, etc.)

Example:

..

Function test3 (postform) {

AJAXFORM (postform, "yoyo3", "attach=showContent")

}

Note: the data will be encoded by escape. The PHP decoding program is provided on the submission processing page.

Additional function

$('div') is equivalent to document.getElementById (' div')

F ('div') is equivalent to document.getElementById (' div'). Value

GetTagValue (XMLDoc, Tag) gets the first occurrence value of the specified TAG in the XML document

$U (str) is equivalent to encodeURIComponent (escape (str))

GetElementsByClass (searchClass,node,tag) gets an array of all nodes under a node whose CLASS is the specified name (copyright information for this function is unknown).

Get news list | Log in | submit information | read JSON | paged list (bingo+json) [upgraded V0.2] | SELECT unlimited linkage | TREE | Select query | album (unlimited playback) | multilingual switch | query drop-down prompt | tag floating prompt (imitating NetEase news display)

This is the end of "how to understand AJAXCALL". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report