Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax in javascript not working
    text
    copied!<pre><code>$(document).ready(function() { $('#content').html(''); $.ajax({ url:'data.json', dataType: "json", success: function(data) { $('#content').append('&lt;p&gt;'+data.rank+'&lt;/p&gt;'); } });}); </code></pre> <p>In this code (it works) <code>data.json</code> contains the JSON data in this format:</p> <pre><code>{ "user_id":"3190399", "user_name":"Anand_Dasgupta", "followers_current":"86", "date_updated":"2009-06-04", "url":"", "avatar":"205659924\/DSC09920_normal.JPG", "follow_days":"0","started_followers":"86", "growth_since":0, "average_growth":"0", "tomorrow":"86", "next_month":"86", "followers_yesterday":"86", "rank":176184, "followers_2w_ago":null, "growth_since_2w":86, "average_growth_2w":"6", "tomorrow_2w":"92", "next_month_2w":"266", "followersperdate":[] } </code></pre> <p>This data comes from the URL:</p> <p><a href="http://twittercounter.com/api/?username=Anand_Dasgupta&amp;output=json&amp;results=3" rel="nofollow noreferrer">http://twittercounter.com/api/?username=Anand_Dasgupta&amp;output=json&amp;results=3</a><br> (Click the URL to get the data)</p> <p>But when I replace <code>data.json</code> in the <code>$.ajax</code> function with the URL which contains the same data, this code below doesn't seem to work...</p> <pre><code>$(document).ready(function() { $('#content').html(''); $.ajax({ url:'http://twittercounter.com/api/username=Anand_Dasgupta&amp;output=json&amp;results=3', dataType: "json", success: function(data) { $('#content').append('&lt;p&gt;'+data.rank+'&lt;/p&gt;'); } });}); </code></pre> <p>Any help with the problem will be highly appreciated.<br> Thanks in anticipation,<br> Anand</p>
 

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