#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2008
    Posts
    43
    Rep Power
    7

    Jquery cors with no jsonp


    Hi,

    I'm very new to cross domain scripting issues please be gentle .

    Is there a way to make a ajax call to a server with a json response(no jsonp) without using a proxy? Maybe modifying the jquery to expect a json instead of jsonp?

    This is what im trying, it is getting the response, but throwing this error since it is expecting the callback i believe.

    Uncaught SyntaxError: Unexpected token :


    Code:
    $.ajax({ url: url + "?jsonpcallback=?", 
    dataType: "jsonp", 
    type : 'GET', 
    crossDomain: true, 
    success: function(data) { alert(data); },
     error: function(data) { alert('oh no!'); } });
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,169
    Rep Power
    184
    I would say your best alternative (given your limitation requirements); would be to send a jQuery .ajax() request Cross-Domain with YQL. Here is a tutorial; that might help you get started: http://net.tutsplus.com/tutorials/ja...ql-and-jquery/.

IMN logo majestic logo threadwatch logo seochat tools logo