Re: Using values passed through AJAX

Giganews Newsgroups
Subject: Re: Using values passed through AJAX
Posted by:  Tom Cole (tcol…
Date: Fri, 28 Mar 2008

On Mar 26, 7:34=A0pm, "Matthew White" <mgw.…> wrote:
> Hello,
> I have an AJAX website that call on a PHP page to tell it how to handle th=
> back/forward buttons. =A0This involves sending a user id (randomly created=
> the start of the session) and a variable that tells PHP what page to look
> for in the history. =A0This is the code (using Mootools):
> function retrievehistory(userid, location){
> =A0 =A0 =A0 =A0 var params =3D Object.toQueryString({id: userid, pageid: l=
> action:"retrieve"});
> =A0 =A0 =A0 =A0 var myAjax =3D new Ajax("history.php", {method: 'post', da=
ta: params, update:
> $('bodydiv')}).request();
> }

Not sure what this Ajax object is...

> The history.php page sends back the address of the page you were last on.
> How do I use this value? =A0It needs to take the value and then submit tha=
t to
> another function that load the page. =A0If anyone can find a way to proces=
> that information using either Mootools or Dojo or plain Javascript, I woul=
> be appreciative.
> Thanks in advance,
> Matthew White

In your Ajax callback handler set the document.location to the value
returned. Because I don't know
anything about this Ajax object I can't say for sure how to get the
responseText from it, etc., but basically
you want to set the document.location to the value of the
XMLHttpRequest's responseText.


In response to

Using values passed through AJAX posted by Matthew White on Wed, 26 Mar 2008