Javascript in Ajax

Source: Internet
Author: User



Function createxmlhttprequest (){

If (window. activexobject ){

XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");


Else if (window. XMLHttpRequest ){

XMLHTTP = new XMLHttpRequest ();




Function queryuserinfo (){

VaR jrntl_id = Document. getelementbyid ("jrntl_id"). value;
If (jrntl_id = ""){


VaR url = "../JSP/gywork/getinfo. jsp? Userid = "+ jrntl_id;


Createxmlhttprequest ();

XMLHTTP. onreadystatechange = handleaddstatechange;

XMLHTTP. Open ("get", URL, true );

XMLHTTP. Send (null );


Function handleaddstatechange (){

If (XMLHTTP. readystate = 4 ){

If (XMLHTTP. Status = 200 ){

VaR responsexml = XMLHTTP. responsexml;
VaR queryresult = responsexml. getelementsbytagname ("queryresult") [0]. firstchild. nodevalue;

If ("failed" = queryresult ){
Document. All ("jyid"). innerhtml = "enter the correct number ";
} Else {
VaR name = responsexml. getelementsbytagname ("name") [0]. firstchild. nodevalue;
VaR bank_id = responsexml. getelementsbytagname ("bank_id") [0]. firstchild. nodevalue;
VaR bank_name = responsexml. getelementsbytagname ("bank_name") [0]. firstchild. nodevalue;
Document. getelementbyid ("jrntl_id_name"). value = Name;
Document. getelementbyid ("jrnbr"). value = bank_id;
Document. getelementbyid ("jrnbr_name"). value = bank_name;
Document. All ("jyid"). innerhtml = "correct ";


Else {

Alert ("An error occurred while obtaining background data! ");




Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.