Gets the ID on the address (the page interacts with the server)

Source: Internet
Author: User

1 <!DOCTYPE HTML>2 <HTML>3 <HeadLang= "en">4     <MetaCharSet= "UTF-8">5     <title></title>6 </Head>7 <Scripttype= "Text/javascript"src=".. /.. /js/system.js "></Script>8 <Body>9ID Number:<DivID= "Showid"></Div>Ten          <inputtype= "button"value= "Get"ID= "BTN"> One <Scripttype= "Text/javascript"> A     $$("btn"). onclick= function () { -         varURL= "http://ama.adwo.com/advmessage/adv/addResultJsonP.action?advid=30125"; -         varXHR= NULL;//set to NULL for compatibility processing the         //Compatibility processing -         if(window. XMLHttpRequest) {//General Browser Use - XHR= NewXMLHttpRequest (); -         } Else if(window. ActiveXObject) {//IE6 Use below + XHR= NewActiveXObject ("Microsoft.XMLHTTP"); -         } +         //Open this object first A Xhr.open ("GET", URLs,true);//How to send the data get, path URL, at         //then send the request again - xhr.send (); - Xhr.onreadystatechange= function () { -             if(Xhr.readystate== 4) {//the request is complete and the response is ready -                 //200 corresponds to OK, such as 404-page not found -                 if(Xhr.status==  $) {//"OK" in                     //get the contents of the URL address -                     varneed=Xhr.response; to                     //truncate the string in the middle brace, including the curly braces +                     varSt=Need.split ("[")[1]; -                     varSTT=St.split ("]")[0]; the                     //converts the acquired string to an object and is named C * Eval ("var c=" +STT); $                     $$("Showid"). InnerHTML=c.id;Panax Notoginseng comm.cl (xhr.response); -                 } the             } +         } A     }; the </Script> + </Body> - </HTML>

Gets the ID on the address (the page interacts with the server)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.