Any Ajax code example which is supported by Chrome and Mozilla ?
Any Ajax code example which is supported by Chrome and Mozilla ?
Hi Dinesh,
we want to use ajax on change script field. we have ajax code for IE but it is not supported on mozilla and chrome. Sample we are using are below :
function GetDescription() {
var strQS = location.href.split(/\?/)[1];
var strAddr;
if (window.location.toString().toLowerCase().search('eware.dll')==-1) {
strAddr = window.location.toString().split('CustomPages')[0];
} else {
strAddr = window.location.toString().split('eware.dll')[0];
}
product = document.getElementById('qutd_product').value;
var strURL = strAddr + 'CustomPages/Quotation/ERPDesc.asp?product=' + product + '&' + strQS;
if (window.XMLHttpRequest) {
XmlHttp = new XMLHttpRequest();
} else {
// IE6 and before
XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
XmlHttp.open('GET',strURL,false);
XmlHttp.setRequestHeader('Content-Type', 'text/xml');
XmlHttp.send(null);
var strHtml = XmlHttp.responseText;
XmlHttp=null; // always clear the XmlHttp object when you are done to avoid memory leaks
document.getElementById('qutd_desc').value = strHtml;
}
Hi,
I reckon this is what you're looking for:
[code language="javascript"] var xmlhttp; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } [/code]
Reference:
www.w3schools.com/.../ajax_xmlhttprequest_create.asp
If you're using v7.1 SP2 or later, you might want to give jQuery a go:
http://api.jquery.com/jQuery.get/
Hope this helps,
Rob
*Community Hub is the new name for Sage City