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 6669307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:08:04+00:00 2026-05-26T03:08:04+00:00

There are several questions on Stack Overflow saying cross domain AJAX request etc will

  • 0

There are several questions on Stack Overflow saying cross domain AJAX request etc will not work because of security reasons. Some questions like this explain this. (Please let me know if I am wrong.)

This is working perfectly fine:

$(document).ready(function() { 
  $.getJSON("http://search.twitter.com/search.json?q=test&callback=?", function(data) {
    alert("test alert outside loop");
    $.each(data.results, function() {
      alert("test alert inside loop");
    });
  });
});

But just replacing the URL with my application won’t work. In that case response code is 200, but there’s no response data. There is an hit on my application; I can see that in console.

$(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");
    });
  });
});

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 protect_from_forgery call in my application controller in my Rails app, but i don’t think that matters.

EDIT

i have deployed the app on http://deals.textadda.com/cities.json now check it… Its not working..

U can try it. these two links http://jsfiddle.net/2arbY/
http://jsfiddle.net/fHxf9/

  • 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-26T03:08:04+00:00Added an answer on May 26, 2026 at 3:08 am

    The problem is that this remote server returns JSON, not JSONP. It returns:

    {"lines":[{"line":"COLOMBO - BADULLA"},{"line":"COLOMBO - MATALE"},{"line":"COLOMBO - PUTTLAM"},{"line":"COLOMBO - THANDIKULAM"},{"line":"COLOMBO - TALAIMANNAR"},{"line":"COLOMBO - BATTICALOA"},{"line":"COLOMBO - TRINCOMALEE"},{"line":"COLOMBO - MATARA"},{"line":"COLOMBO - AVISSAWELLA"},{"line":"COLOMBO - MIHINTALE"}]}
    

    instead of:

    someCallbackName({"lines":[{"line":"COLOMBO - BADULLA"},{"line":"COLOMBO - MATALE"},{"line":"COLOMBO - PUTTLAM"},{"line":"COLOMBO - THANDIKULAM"},{"line":"COLOMBO - TALAIMANNAR"},{"line":"COLOMBO - BATTICALOA"},{"line":"COLOMBO - TRINCOMALEE"},{"line":"COLOMBO - MATARA"},{"line":"COLOMBO - AVISSAWELLA"},{"line":"COLOMBO - MIHINTALE"}]})
    

    Thats why I was not be able to consume a remote domain using AJAX unless this remote resource supports JSONP.

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

Sidebar

Related Questions

There are several questions on Stack Overflow discussing how to find the Greatest Common
There are several topics about what questions will be raised in an interview for
I've looked over several questions on Stack Overflow for how to convert spaces to
There have been several questions already posted with specific questions about dependency injection ,
There have been several questions recently about database indexing and clustered indexing and it
There have been several questions posted to SO about floating-point representation. For example, the
There have been several questions over the past few days about the proper use
Possible Duplicate: New Cool Features of C# 4.0 Hello, There are several(many) questions at
I have read tutorials and several stack overflow posts that suggest I should use
I want to make an ajax auto complete field like stack overflow's tag search

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.