Actually, you just have to add ?callback=?
, jQuery does the rest.
$(document).ready(function() {
$.getJSON('http://example.com/api/get_cats?callback=?', function(fbResults) {
document.write(fbResults.cats[0].title);
});
});
More Related Contents:
- AJAX cross domain call
- Post data to JsonP
- Javascript search inside a JSON object
- AJAX call and clean JSON but Syntax Error: missing ; before statement
- JSON string to JS object
- Using JSONP to get JSON data from another server
- Loading local JSON file
- Convert XML to JSON (and back) using Javascript
- Converting JavaScript object with numeric keys into array
- Convert array to JSON
- jQuery.parseJSON throws “Invalid JSON” error due to escaped single quote in JSON
- Unexpected token colon JSON after jQuery.ajax#get
- Parsing JSON objects for HTML table
- Why is it a bad practice to return generated HTML instead of JSON? Or is it?
- How to get json key and value in javascript?
- How do I encode a JavaScript object as JSON?
- Defining a HTML template to append using JQuery
- Nested JSON objects – do I have to use arrays for everything?
- JS Object this.method() breaks via jQuery
- Error “Uncaught SyntaxError: Unexpected token with JSON.parse”
- Does Wikipedia API support CORS or only JSONP available?
- Convert js Array() to JSon object for use with JQuery .ajax
- IE10/11 Ajax XHR error – SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3
- Convert JSON string to Javascript array [duplicate]
- How to loop through JSON array?
- How to send parameter json array when modal open?
- Why does the jQuery JSON parser need double escaping for backslashes?
- jQuery uses (new Function(“return ” + data))(); instead of eval(data); to parse JSON, why?
- Grouping JSON by values
- JQuery getJSON – ajax parseerror