This post was most recently updated on August 11th, 2019
Problem Statement: Async Ajax Call using XMLHttpRequest
Solution :
below is the code snippet help you for Async Ajax call using XMLHttpRequest
1 2 3 4 5 6 7 8 9 10 11 12 13 |
var client = new XMLHttpRequest(); var URL='/Home/Index'; client.open('POST',URL, true); // parameters for Open (method:string , url:string , async?:boolean , user?:string,password?:string) client.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); client.setRequestHeader("dataType", "html"); client.send("para1=" + parmetervalue1 + "¶2=" + parmetervalue2); client.onloadend = function (response) { return response; } client.error = function (ex) { window.location.reload(); } |