devxlogo

Use the XMLHttpRequest Object to Post Data

Use the XMLHttpRequest Object to Post Data

When using XMLHttpRequest object, there is a way to post data in the same way that an HTML Form is posted.

All you need to do is add an HTTP header, and send the data the same way you’d send it on the QueryString.

Here’s a JScript example for the client side, that submits form data to another page:

  var objHTTP, strResult;  objHTTP = new ActiveXObject('Microsoft.XMLHTTP');  objHTTP.open('POST',"OtherPage.asp",false);  objHTTP.setRequestHeader('Content-Type','application/x-www-form-urlencoded');  objHTTP.send("id=1&user="+txtUser.value+"&password="+txtPassword.value);  strResult=objHTTP.responseText;

See also  How to Create and Deploy QR Codes Online: A Comprehensive Guide
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist