| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: May 2008
Posts: 248
![]() ![]() | More than one ajax request? I'm just learning about the XmlHttpRequest object. I have a basic demonstration for myself built, but I can only use it once. After pressing the "submit" button, I have to exit out of firefox before trying it again. If I press the button more than once, nothing happens. I think I need to restart the object for accepting requests at the end of my code or something. . .but I don't know how. Pls. . .helps. . . Code: createobjectandstuff()
{
req.onreadystatechange = function()
{
document.ajax.txt.value="Attacking...";
if(req.readyState == 4)
{
if(req.status == 200)
{
document.ajax.txt.value=req.responseText;
}
else
{
document.ajax.txt.value="Error: returned status code " + req.status + " " + req.statusText;
}
}
};
req.open("GET", "fileiwantoget.php", true);
req.send(null);
}
__________________ Are you tired of viruses and popups? Use Firefox! |
| |
| | #2 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | i'm no ajax expert, but whenever i've used it i've always called the function with onkeyup, onchange, onblur, or onfocus. if you look on w3schools.com they have the basic framework that almost all ajax scripts need (which i don't see in your code, but then again you could be doing some other method i don't know about).
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| |