Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to enable cross-domain request on the server?
    primarykey
    data
    text
    <p>I have a json file hosted on my server. When I try to make an Ajax "GET" request to the json file, it fails.</p> <p>See the console in Safari, it says "Failed to load resource".</p> <p>Firebug shows "200 OK", but the response doesn't show up. Even Firebug does not show the JSON tab.</p> <p>I believe this is because Cross Domain Requests are not allowed using AJAX.</p> <p>I would like to know how can I overcome this? Also, if I want to enable cross-domain requests on my server, I believe a <code>crossdomain.xml</code> file or something needs to be created. I am not sure, but this is what I know. I searched on Google, but could not find any relevant links.</p> <p>Any help in this is highly appreciated.</p> <p>Thanks.</p> <p><strong>UPDATE:</strong> I am not using any server-side scripting language (PHP, ASP.NET, etc). I am using Plain HTML and JavaScript / jQuery.</p> <p><strong>UPDATE-2:</strong></p> <p>I used the following code to make cross-domain requests:</p> <pre><code>&lt;script src="jquery-1.6.2.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function () { $.ajax({ dataType: 'jsonp', data: '', jsonp: 'jsonp_callback', url: 'http://myhosting.net/myjsonfile.json', success: function (jsonData) { alert("success") alert(jsonData); }, error: function(errorObj) { alert(errorObj.statusText); }, }); }); </code></pre> <p>When i see in Firebug's "Net" tab, I see a JSON tab, and I am able to see the json response. However, the "success" callback handler doesn't get called, but the "error" callback handler gets invoked and I get the alert saying <code>parseerror</code>.</p> <p>Any idea what could be wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload