Simple Ajax application.

Source: Internet
Author: User

<MCE: script language = "JavaScript"> <! -- <Br/> var request = false; </P> <p> var flag = true; </P> <p> // create an instance of the xmlhttprequst object <br/> function createrequest () <br/>{< br/> If (window. XMLHttpRequest) <br/>{< br/> request = new XMLHttpRequest (); <br/>}< br/> else if (window. activexobject) <br/>{< br/> request = new activexobject ("msxml2.xmlhttp"); <br/>}< br/> If (! Request) {<br/> alert ("error initializing XMLHttpRequest! "); <Br/>}</P> <p> function getisnotrepeat () {<br/> createrequest (); <br/> var exportdate = document. frmexico portsubjectbalance. strexportsubjectbalancedate. value; <br/>/* modify here */<br/> var url = "<% = strcontext %>/findexistsubjectbalance. JSP? Exportdate = "+ exportdate; <br/> request. open ("get", URL, false); <br/> request. onreadystatechange = updatepage; <br/> request. send (null); <br/>}</P> <p> function updatepage () {<br/> If (request. readystate = 4) {<br/> If (request. status = 200) {<br/> var resptext = request. responsetext; <br/>/* You need to modify it here */<br/>/* 1 is returned, and the account balance already exists */<br/> If (resptext = 1) {<br/> If (confirm ('account balance already exists, are you sure you want to import it again? ') {<Br/> flag = true; <br/>} else {<br/> flag = false; <br/>}< br/> // --> </MCE: SCRIPT>

The control page has the following code:

Printwriter = response. getwriter (); <br/>/* database operation result */<br/> printwriter. println (isexist); <br/> printwriter. flush (); <br/> printwriter. close ();

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.