jQuery Cross Domain Ajax

前端 未结 7 1931
Happy的楠姐
Happy的楠姐 2020-12-09 05:06

My ajax code is

$.ajax({
    type: \'GET\',
    dataType: \"jsonp\",
    processData: false,
    crossDomain: true,
    jsonp: false,
    url: \"http://someo         


        
7条回答
  •  生来不讨喜
    2020-12-09 05:24

    If you are planning to use JSONP you can use getJSON which made for that. jQuery has helper methods for JSONP.

    $.getJSON( 'http://someotherdomain.com/service.svc&callback=?', function( result ) {
           console.log(result);
    });
    

    Read the below links

    http://api.jquery.com/jQuery.getJSON/

    Basic example of using .ajax() with JSONP?

    Basic how-to for cross domain jsonp

提交回复
热议问题