Using values passed through AJAX

M

Matthew White

Hello,

I have an AJAX website that call on a PHP page to tell it how to handle the
back/forward buttons. This involves sending a user id (randomly created at
the start of the session) and a variable that tells PHP what page to look
for in the history. This is the code (using Mootools):

function retrievehistory(userid, location){
var params = Object.toQueryString({id: userid, pageid: location,
action:"retrieve"});
var myAjax = new Ajax("history.php", {method: 'post', data: params, update:
$('bodydiv')}).request();
}

The history.php page sends back the address of the page you were last on.
How do I use this value? It needs to take the value and then submit that to
another function that load the page. If anyone can find a way to process
that information using either Mootools or Dojo or plain Javascript, I would
be appreciative.

Thanks in advance,
Matthew White
 
T

Tom Cole

Hello,

I have an AJAX website that call on a PHP page to tell it how to handle the
back/forward buttons.  This involves sending a user id (randomly createdat
the start of the session) and a variable that tells PHP what page to look
for in the history.  This is the code (using Mootools):

function retrievehistory(userid, location){
        var params = Object.toQueryString({id: userid, pageid: location,
action:"retrieve"});
        var myAjax = new Ajax("history.php", {method: 'post', data: 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?  It needs to take the value and then submit that to
another function that load the page.  If anyone can find a way to process
that information using either Mootools or Dojo or plain Javascript, I would
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.
 
T

Thomas 'PointedEars' Lahn

Matthew said:
The AJAX object is part of Mootools, a JavaScript framework.

A quick search for "framework" reveals that those so-called frameworks,
written by incompetent script-kiddies, based on other frameworks written
by incompetent script-kiddies, are as popular here as is
[top post]

with invalid headers by borken Micro$~1 software.

http://jibbering.com/faq/


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,144
Messages
2,570,823
Members
47,369
Latest member
FTMZ

Latest Threads

Top