jQuery .ajax() with jsonp not invoking success callback function
I have a facebook iframe application that makes a cross domain request to my server and requests data in JSONP format. This is my client side code:
jQuery.ajax({
                url: '***',
                type: 'post',
                data: {
                    method: 'set_user_prizes'
                },
                dataType: 'jsonp',
                jsonp: false,
                jsonpCallbackString: 'callback123',
                success: function(data, textStatus, jqXHR){
    开发者_JAVA技巧                console.log('success_function');
                    console.log(data);
                }
});
The problem is my success callback method isn't being invoked and I'm not sure why. Using Firebug I can see my server's response:
callback123({"success":true,"associated_prizes":[{"prizes_id":"6"},{"prizes_id":"1"}]})
Remove the word String from the callback key as is illustrated in the following transformation. The value needs to remain a string.
Change:
jsonpCallbackString: 'callback123',
to
jsonpCallback: 'callback123',
The correct answer is
jsonpCallback: 'callback123'
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论