PDA

View Full Version : get 2 resposnes in the same function


esthera
04-24-2009, 08:13 AM
my current code is below
How would I in the same function also get the buyprice by checking the page
xmlHttp.open("GET","ajaxloadbuyprice.asp?itemid=<%=request("itemid") %>",true);


if(xmlHttp.readyState==4)
{

document.trade.sellprice.value=xmlHttp.responseText;
document.getElementById("spsellprice").innerHTML=xmlHttp.responseText;
var _pricepaidperpoint=document.trade.pricepaidperpoint.value;
if (_pricepaidperpoint>0){ checktrade(_pricepaidperpoint); }

}
}
xmlHttp.open("GET","ajaxloadsellprice.asp?itemid=<%=request("itemid") %>",true);
xmlHttp.send(null);

A1ien51
04-26-2009, 02:48 PM
You pass in a URL to your function that makes an Ajax call.

You really should look at using a LIbrary such as JQuery or Prototype to make Ajax calls since it will make it a lot easier.

Eric

rfresh
04-30-2009, 03:25 AM
Pass your data back in one string separated by a unique set of characters. For example, I send back the current number of the file I am processing and in the second field I have the results of the search I am doing on the file.

So when I send back the file my script is working on, my string looks like this:

5@@0

The first digit is the file being worked on. Back in my main form I use JS .splt function on the "@@" and use the [0] array element for the file number in a div.

When my search results is echoing back (im using php) it looks like this:

0@@search results string

and I use the [2] array element from the .split function.