Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 272933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:22:44+00:00 2026-05-12T00:22:44+00:00

Ok…so ive been wriggling around with this piece of cod for quite a while

  • 0

Ok…so ive been wriggling around with this piece of cod for quite a while now…

first i used this code which worked…


$(document).ready(function() {
$('#content').html('');
$.ajax({
        url:'data.json',
        dataType: "json",
        success: function(data) {
                $('#content').append('

'+data.rank+'

'); } });});

In this code (it works) data.json contains the JSON data in this format:

{
"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":[]
}

This data comes from the URL:

http://twittercounter.com/api/?username=Anand_Dasgupta&output=json&results=3
(Click the URL to get the data)

But when I replace data.json in the $.ajax function with the URL which contains the same data, this code below doesn't seem to work...


$(document).ready(function() {
$('#content').html('');
$.ajax({
      url:'http://twittercounter.com/api/?username=Anand_Dasgupta&output=json&results=3',
        dataType: "json",
        success: function(data) {
                $('#content').append('

'+data.rank+'

'); } });});

I had earlier put this question forth on StackOverflow and responses were that this is a cross domain problem.

So i read about cross domain ajax request and this is the code that i came up with:


$(document).ready(function() {                      
    $('form#search').bind("submit", function(e){                            
            e.preventDefault();
            $('#content').html('');

// Define the callback function
  function get(jsonData) {     
     $('#content').append('

'+jsonData.rank+'

'); bObj.removeScriptTag(); } // The web service call var req = 'http://twittercounter.com/api/?username=Anand_Dasgupta&output=json&results=3&callback=get'; // Create a new request object bObj = new JSONscriptRequest(req); // Build the dynamic script tag bObj.buildScriptTag(); // Add the script tag to the page bObj.addScriptTag(); }); });

But even doesnt seem to be working.

If anyone can provide any help then it will be deeply appreciated.
I have given the entire code so that anyone could test it themselves if they want to.

Thank you
Anand

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:22:45+00:00Added an answer on May 12, 2026 at 12:22 am

    You have to see if the site in question supports JSONP.

    You have to also use the dataType option in your ajax call set to 'jsonp', as well as specify the correct callback argument.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this xml <entry id=1008 section=articles> <excerpt><p>&#8230; in Richtung „Aus für Tierversuche. Kosmetik-Fertigprodukte
Why does the Android system throw this Exception? 05-18 12:33:44.169 W/System.err( 8230): java.io.IOException: Is
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have my code like this: for (i in 1:b) { carteraR[[i]]=subset(carteraR[[i]],RUN.FONDO==8026 | RUN.FONDO==8036
what about this one: I want to format the currentTime displayed by a videoPlayer
I have been making a wordpress template. i got stuck at some place... the
I want to run this <!-- This will remove the tag --> <xsl:template name=remove-html>
An Arabic name shall be sent via SOAP. The name is encoded like this:
I would like to run a str_replace or preg_replace which looks for certain words
I have a PDB file. Now it has two parts separated by TER. Before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.