Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery AJAX response with 200, but no response data, for some remote URL
    primarykey
    data
    text
    <p>There are several questions on Stack Overflow saying cross domain AJAX request etc will not work because of security reasons. Some questions like <a href="https://stackoverflow.com/questions/4840825/ajax-with-jquery-200-ok-but-not-success">this explain</a> this. (Please let me know if I am wrong.)</p> <p>This is working perfectly fine:</p> <pre><code>$(document).ready(function() { $.getJSON("http://search.twitter.com/search.json?q=test&amp;callback=?", function(data) { alert("test alert outside loop"); $.each(data.results, function() { alert("test alert inside loop"); }); }); }); </code></pre> <p>But just replacing the URL with my application won't work. In that case response code is <code>200</code>, but there's no response data. There is an hit on my application; I can see that in console.</p> <pre><code>$(document).ready(function() { $.getJSON("http://192.168.1.2:3000/cities.json?callback=?", function(data) { alert("test alert outside loop"); $.each(data.results, function() { alert("test alert inside loop"); }); }); }); </code></pre> <p>I am developing a very simple mobile app using PhoneGap so I need to make this call using JavaScript. But the main thing that's confusing me is why the Twitter call is working, but the call to my app isn't. I've also tried to remove the <code>protect_from_forgery</code> call in my application controller in my Rails app, but i don't think that matters.</p> <p><strong>EDIT</strong></p> <p>i have deployed the app on <a href="http://deals.textadda.com/cities.json" rel="nofollow noreferrer">http://deals.textadda.com/cities.json</a> now check it... Its not working..</p> <p>U can try it. these two links <a href="http://jsfiddle.net/2arbY/" rel="nofollow noreferrer">http://jsfiddle.net/2arbY/</a> <a href="http://jsfiddle.net/fHxf9/" rel="nofollow noreferrer">http://jsfiddle.net/fHxf9/</a></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.
 

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