Connecting Tech Pros Worldwide Forums | Help | Site Map

Trying to use AjaxRequest Toolbox class

KnighT
Guest
 
Posts: n/a
#1: Sep 14 '06
myAjax = new AjaxRequest();

//I am trying to use this as an object, but it gives errors when I try
to call myAjax.get() telling me that it is not a public function

so I try direct method acces:

AjaxRequest.url = newLocation;
AjaxRequest.get(
{
'onSuccess':function(req){ document.getElementById("content") =
newLocation; }
}
);

All I want is to load a <div id=contentasynchronously, with the value
of newLocation (which is a web address)

I do not understand how to use this object 'arg' parameter for this
method.
I do not know what the req is as a function parameter


VK
Guest
 
Posts: n/a
#2: Sep 14 '06

re: Trying to use AjaxRequest Toolbox class



KnighT wrote:
Quote:
All I want is to load a <div id=contentasynchronously, with the value
of newLocation (which is a web address)
Why not use the documentation?
<http://www.ajaxtoolbox.com/request/documentation.php>

In the particular AjaxRequest.async = true will do the job for you.

KnighT
Guest
 
Posts: n/a
#3: Sep 14 '06

re: Trying to use AjaxRequest Toolbox class


I got it to work.

AjaxRequest.url = newLocation;
AjaxRequest.get(
{
'onSuccess':function(req){
document.getElementById("content").innerHTML = req.responseText; }
}
);

I had to reset req.url in the ajaxRequest.js class a few times because
it kept pulling the url from the address bar, or querystring.

Matt Kruse
Guest
 
Posts: n/a
#4: Sep 14 '06

re: Trying to use AjaxRequest Toolbox class


KnighT wrote:
Quote:
AjaxRequest.url = newLocation;
AjaxRequest.get(
{
'onSuccess':function(req){
document.getElementById("content").innerHTML = req.responseText; }
}
);
Instead, pass url as a paramter:

AjaxRequest.get({
'url':newLocation,
'onSuccess':function(req){ ... }
});

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com


KnighT
Guest
 
Posts: n/a
#5: Sep 14 '06

re: Trying to use AjaxRequest Toolbox class


Oh, ok......now I see how to use the parameters. You did a very nice
job on the AjaxRequest class. Thank you Mr.Kruse
Matt Kruse wrote:
Quote:
KnighT wrote:
Quote:
AjaxRequest.url = newLocation;
AjaxRequest.get(
{
'onSuccess':function(req){
document.getElementById("content").innerHTML = req.responseText; }
}
);
>
Instead, pass url as a paramter:
>
AjaxRequest.get({
'url':newLocation,
'onSuccess':function(req){ ... }
});
>
--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Closed Thread


Similar JavaScript / Ajax / DHTML bytes