Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-24-2009, 07:13 AM   PM User | #1
esthera
Senior Coder

 
Join Date: May 2004
Posts: 1,432
Thanks: 14
Thanked 0 Times in 0 Posts
esthera can only hope to improve
get 2 resposnes in the same function

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);
Code:
   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);
esthera is offline   Reply With Quote
Old 04-26-2009, 01:48 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
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
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 04-30-2009, 02:25 AM   PM User | #3
rfresh
Regular Coder

 
Join Date: Jun 2007
Location: Los Angeles
Posts: 545
Thanks: 81
Thanked 5 Times in 5 Posts
rfresh is an unknown quantity at this point
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.
__________________
RalphF
Business Text Messaging Services
https://www.MobileTextingService.com
rfresh is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:35 AM.


Advertisement
Log in to turn off these ads.