JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 5th, 2012, 04:28 PM
makzan makzan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 102 makzan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 4 h 51 m 48 sec
Reputation Power: 9
Ajax .open Empty Error

Hi,

I've tried searching for a solution to this problem, but it's quite tricky when I get absolutely no error!

I had a working script that used Ajax to get an up to date rating from a php file. I'm in the process of upgrading my site to HTML5 and the script stopped working. The only error I would get was in Firefox Web Developer Web Console stating the line where the error was occuring. It gave absolutely no error message or reference besides that. I wasn't sure if Ajax worked slightly differently in HTML5, so I've used a different script (below), but it still gives the same blank error.

Can anyone see what I'm doing wrong? The PHP file definitely exists and returns valid data when accessed directly.

The blank error references the following line:
Code:
arequest.open('GET','userrating.php?h=' + h,true);


Code:
function ajaxRequest(){
	var activexmodes = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
	if(window.ActiveXObject){
		for(var i = 0; i < activexmodes.length; i++){
			try {
				return new ActiveXObject(activexmodes[i]);
			} catch(e){
				//suppress error
			}
		}
	} else if(window.XMLHttpRequest){
		return new XMLHttpRequest();
	} else {
		return false;
	}
}

function resetRating(h){
	var arequest = new ajaxRequest();
	arequest.onreadystatechange = function(){
		// do something
	}
	var h = encodeURIComponent(h);
	arequest.open('GET','userrating.php?h=' + h,true);
	arequest.send(null);
}


Thanks, Ian

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Ajax .open Empty Error

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap