Issue With Xmlhttp Request |
||
Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.
In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.
Zymic Webmaster Forums Web Design & Development Client Side Scripting JavaScript |
||
![]() |
Issue With Xmlhttp Request |
||
Aug 3 2011, 08:45 PM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 1 Joined: 3-August 11 Member No.: 201,722 |
Im trying to add a twitter trends section to my web site, im trying to do this using the json object that twitter provides from accessing this URL (http://api.twitter.com/1/trends.json) when i use the following code i see the below error. Does anyone know where im going wrong ?
var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "http://api.twitter.com/1/trends.json",true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { if (xmlhttp.status!=404) { alert(xmlhttp.responseText); } } } xmlhttp.send(null); Error : XMLHttpRequest cannot load http://api.twitter.com/1/trends.json. Origin null is not allowed by Access-Control-Allow-Origin. This was tested in chrome but worked in IE and idea's ? |
|
|
Aug 4 2011, 12:27 AM
Post
#2
|
|
|
THE SILENT FORUM NINJA ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrators Posts: 3,758 Joined: 23-January 10 From: on your screen Member No.: 127,507 |
its due the fact that ALL remote connections are NOT allowed on Zymic
|
|
|
Mar 22 2013, 09:10 PM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 1 Joined: 21-March 13 Member No.: 277,249 |
its due the fact that ALL remote connections are NOT allowed on Zymic what if I only trying to load the local file? Like bellow: CODE if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); }else{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } var xmlPath="http://myzymicID.zxq.net/"+"Assets/"+document.title+".xml"; xmlhttp.open("GET",xmlPath,false); // by using "false" at async, the script will not go pass this line. But if I change to "true", it will just hang in xmlhttp.readyState ==0 and page not found xmlhttp.send(null); xmlDoc = xmlhttp.responseXML; var photoX = xmlDoc.getElementsByTagName("photoX"); var photoIcons=new Array(); var photoTips=new Array(); //..... and so on and so to load my photos The same script works elsewhere, but just not here, is there anything I need to change in order for my photo album to load out of the xml file? |
|
|
Mar 23 2013, 04:37 AM
Post
#4
|
|
|
THE SILENT FORUM NINJA ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrators Posts: 3,758 Joined: 23-January 10 From: on your screen Member No.: 127,507 |
dont add the http://myzymicID.zxq.net/ and then the server wont read it as remote connections and will allow you to use it
|
|
|
![]() |
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users) |
||
| 0 Members: | ||
Forum Jump |
||
| Lo-Fi Version | Time is now: 20th June 2013 - 02:58 AM |