1

Is there any way to load the json provided by the http://search.twitter.com/search.json URL on to my page via ajax? Everything I've tried gives me:

XMLHttpRequest cannot load http://search.twitter.com/search.json. Origin null is not allowed by Access-Control-Allow-Origin.

If not, then whats the point of having such services in the first place?W

1 Answer 1

3

Use JSONP, or JSON with padding:

<script type = "text/javascript">
    window.getTwitterResults = function(data) {
      console.log(JSON.stringify(data));
    };
</script>
<script type = "text/javascript" src = "http://search.twitter.com/search.json?q=cheese&callback=getTwitterResults"></script>
Sign up to request clarification or add additional context in comments.

1 Comment

Did not know the callback thing existed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.