The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JSONP Cross Browser Issues

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #41020

    I am having tons of trouble trying to pull cross-domain json data. It works perfectly when the json is local, but as soon as I try the same code cross domain, it breaks. I must be having issues with JSONP but not sure what it is… can anyone help?

    Here is the JSON Code

    “name”: “John Smith”,
    “age” : “34”,
    “sex”: “male”

    and the javascript is

    url: ‘’,
    dataType: ‘jsonp’,
    jsonpCallback: ‘knoxStaff’, // specify the callback name if you’re hard-coding it
    success: function(staff){
    document.write(;// we make a successful JSONP call!

    I left up the json file on the server in case anyone wants to try to pull it successfully. THANKS for anyone’s time in advance, I just can’t crack this one!


    It has something to do with enabling a callback, but that’s as far as my knowledge goes. Generally you’d include it on the `url` itself: ``

    That’s a crude example.


    Thanks so much for your response Doc… I tried an example of that route too:

    $.getJSON(“”, function(data) {
    document.write(;// we make a successful JSONP call!

    But that came up empty too. Driving me nuts! Is anyone able to make this work or guide me in the right direction?


    I just tried your example link and it worked perfect for me, what browsers are you testing in?


    The link to the data works, but trying the jquery to pull in the data displays nothing… or did that part work for you??? That would be great news, but I am not seeing it here. Have tried Chrome, Firefox and Safari.

    I managed to get rid of all errors on the console, but it just doesn’t display the data. The document.write function does not seem to be doing anything, just a blank page.

    Thanks for your help SgtLegend, would really love to figure this out!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.