I found a way that works in all browsers and tested below. If you have any code updates to below let me know thank you.
var xmlHttp = null;
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
var versions = [
"MSXML2.XmlHttp.6.0",
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",
"MSXML2.XmlHttp.3.0",
"MSXML2.XmlHttp.2.0",
"Microsoft.XmlHttp"];
var xhr;
for (var i = 0; i < versions.length; i++) {
try {
xmlHttp = new ActiveXObject(versions[i]);
break;
} catch (e) {
}
}
}
if (xmlHttp != null) {
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
document.getElementById("divLOAD").style.display = "none";
var data = JSON.parse(xmlHttp.responseText);
if (data == "" && sIsAutoComplete == "F") {
PlateResult("", "", "", "", "RED", sSearch);
return;
}
else if (data == "") {
return;
}
if (sIsAutoComplete == "T") {
return AutoComplete(data);
}
else if (sIsAutoComplete == "F") {
SearchPlateShow(data, "F");
}
else if (sIsAutoComplete == "A") {
s_CacheSelectedCompanyID = s_SelectedCompanyID;
AllData = data;
var dt = new Date();
CacheDate.setTime(dt.getTime() + (CacheMinutes * 60 * 1000));
}
}
}
xmlHttp.onerror = function () {
document.getElementById("divLOAD").style.display = "none";
if (sIsAutoComplete == "T") {
return AutoComplete(AllData);
}
else if (sIsAutoComplete == "F") {
SearchPlateShow(AllData, "T");
}
}
xmlHttp.open("POST", "/Home/SearchPlate/", true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send('__RequestVerificationToken=' + sToken + '&sLicensePlate=' + Encode(sLicensePlate) + '&sIsAutoComplete=' + sIsAutoComplete + '&sID=' + s_SelectedCompanyID + '&sKey=' + sKey + '&sIV=' + sIV);
}
else {
document.getElementById("spParkingTracker").innerHTML = "Browser not supported!";
}