Ajax lookup function ~ Ajax Training, Learn Ajax Video Tutorials Online, Ajax Examples
Ajax Training, Learn Ajax Video Tutorials Online, Ajax Examples: Ajax lookup function

Ajax lookup function

Here is a simple look up function using ajax (XMLHttpRequest object).

function lookup(tbl,res,fld,val) {
var req;
var url='lookup.php?tbl='+tbl+'&res='+res+'&fld='+fld+'&val='+val;
req = false;
// branch for native XMLHttpRequest object

if(window.XMLHttpRequest) {
try {
req = new XMLHttpRequest();
} catch(e) {
req = false;
}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = false;
}
}
}
if(req) {
//req.onreadystatechange = processReqChange;
req.open("GET", url, false);
req.send('-');
}
return req.responseText;
}

Related Posts by Categories

1 comments:

Anonymous said...

hello... hapi blogging... have a nice day! just visiting here....

Useful Links on Adobe Flex

Your Ad Here

Latest Books on Adobe Flex