How to do muliple lookups using Ajax?

Hi, I am new to ajax and in in one of my web projects I have four combo boxes which have to be lookup using ajax.Could any one suggest me how to fulfill this requirement. Any help would be appreciable. Thank you.

Subject: How to do muliple lookups using Ajax ?

you can use lookups like this in ajax

var req;

var strField;

var lkpKey;

var sType; // 1 - combo box , 2 - text multiple value

var Col; // used for column selection in a view

function dbLookup(server,path,view,key,column,Name, xType,protocols)

{

	sType = xType;

	lkpKey=key;

	col = column;

	strField=Name //Put your second combo name here to get dblookup result

	var pos=0;

	currURL = (document.location.href).toLowerCase();

// alert(currURL);

	if (server == "")

	{			

		pos = currURL.indexOf('://');

		if (pos < 0 )

			{

				server = server  // Put your server name here

			}	

	}

	else

		{

			pos += 3;

			pos = currURL.indexOf('/', pos);

			server = currURL.substring(0, pos)

		}

// Check if path is empty

	if (path == "" )

		{

			if( pos > 0 )

				{

					newPos = currURL.indexOf('.nsf',pos);

					if (newPos > 0)

						{

							path = currURL.substring(pos+1,newPos+4)

						}

				}

		}

//Check if column is empty

	if( column !="" )

		{

			column -= 1;			

			vurl = protocols +  path +"/" + view +"?Readviewentries&restricttocategory="+lkpKey



			//checking whether browser is mozila or Netscape

			if (window.XMLHttpRequest) // Mozilla.. SaFari...

			{

				req = new XMLHttpRequest();

				 if (req.overrideMimeType)	

					{

						req.overrideMimeType('text/xml');

				 	}

					req.onreadystatechange = processReqChange_lookup;

					req.open("GET", vurl , true);

					req.send(null);

			}

			else if (window.ActiveXObject) 	//checking whether browser is IE

				{	

					req = new ActiveXObject("Microsoft.XMLHTTP");

					if (req)

						{ 

							req.onreadystatechange = processReqChange_lookup;

							req.open("GET", vurl, true);

							req.send();

						}

				}

		}

}

or look at this link for other reference

http://www.openntf.org/projects/codebin/codebin.nsf/CodeByDate/0D95F1B6946D706D8625705F0049AB59

http://searchdomino.techtarget.com/tip/0,289483,sid4_gci1126394,00.html?track=Ajax_FG

Subject: RE: How to do muliple lookups using Ajax ?

If you use a global “req” variable and you try to do mulitple lookups asynchronously, you’re probably going to have problems. To understand why, I suggest you see my article here:

 http://www.rhs.com/web/blog/poweroftheschwartz.nsf/d6plinks/RSCZ-6CDPEX

And the follow-up here:

http://www.rhs.com/web/blog/poweroftheschwartz.nsf/d6plinks/RSCZ-6CEQAR

Now, I’m sure there are better (and cooler) ways to code safe AJAX than what I put together in my code samples, but the key point is that if you want to do true multi-threaded asynch coding you’d better have a unique XmlHttpRequest object for each request, stored in a variable that isn’t going to be overwritten or go out of scope before the request is fully processed!

-rich

Subject: Multiple lookups is not working

Thanks for your help, but I got one problem. I have used your code and lookup is working fine for the first field.When I try to use it for the second field it fails and prompts error. Colud you please tell me how to use the same code for muliple fields to lookup.