| | |
how to access cross domain in JSON
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2009
Posts: 8
Reputation:
Solved Threads: 0
hello
Question:
i get "Access denied" error.Can anyone convert the code below in JSON i need to access data from some other domain. OR any other fully explained efficient method to access cross domains plz.
---------js file--------------
Question:
i get "Access denied" error.Can anyone convert the code below in JSON i need to access data from some other domain. OR any other fully explained efficient method to access cross domains plz.
---------js file--------------
JavaScript Syntax (Toggle Plain Text)
window.onload=makeRequest; function makeRequest() { var http_request={}; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); } else { http_request=new ActiveXObject("Msxml2.XMLHTTP"); } http_request.open("GET", "http://www.uclocal.com/LX-U.aspx?", false); http_request.onreadystatechange=function() { if(http_request.readyState==3) { alert("data is loading...please wait"); } else if(http_request.readyState==4) { if(http_request.status==200) { document.write(http_request.responseText); } } } http_request.send(); }
Last edited by peter_budo; May 9th, 2009 at 12:58 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
It's a security feature on browsers, cross-domain AJAX isn't allowed and would be a big issue if it was. If you need to get data from another website use an AJAX call to call a local file which uses cURL or something similar to fetch the file.
Last edited by ShawnCplus; May 8th, 2009 at 2:41 pm.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: change input type in ie
- Next Thread: Javascript Bullets and Numbering
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets api array browser bug captcha captchaformproblem cart checkbox child class close codes cookies createrange() cursor date debugger dependent developer disablefirebug dom dropdown editor element embed engine events explorer ext file firefox form forms getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl maps marquee masterpage math matrixcaptcha media object onerror onmouseoutdivproblem onreadystatechange parent paypal pdf php position post programming progressbar prototype rated redirect runtime safari scale scriptlets scroll search security session shopping size software star stars synchronous toggle tweet unicode variables web webservice wysiwyg \n






