NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page More than one ajax request?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 07-14-2008, 04:58 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
omegapandor's Avatar
Join Date: May 2008
Posts: 248
omegapandor has a spectacular aura aboutomegapandor has a spectacular aura about
 



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!
omegapandor is offline  
Old 07-14-2008, 05:52 PM   #2 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



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).
nasaboy007 is offline  
Old 07-14-2008, 06:31 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
omegapandor's Avatar
Join Date: May 2008
Posts: 248
omegapandor has a spectacular aura aboutomegapandor has a spectacular aura about
 



I just realized that my submit button creates the object every time. I assume this is bad and has something to do with the problem.
__________________
Are you tired of viruses and popups? Use Firefox!
omegapandor is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:22 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger