Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,441
    Thanks
    15
    Thanked 0 Times in 0 Posts

    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);

  • #2
    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
    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]

  • #3
    Regular Coder
    Join Date
    Jun 2007
    Location
    Los Angeles
    Posts
    545
    Thanks
    81
    Thanked 5 Times in 5 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •