ajax request method using jsonp

/ *   
    // short form, the same effect as   
    $ .getJSON ( "http://app.example.com/base/json.do?sid=1494&busiId=101&jsonpCallback=?",   
            Function (the Data) {   
                $ ( "# showcontent" ) .text ( "the Result:" + data.result)   
    });   
    * /   
    $ .ajax ({   
        type: "GET" ,   
        the async: to false ,   
        URL: "http://app.example.com/base/json. ? sid = 1494 & do = 101 busiId " ,   
        dataType: " JSONP ", // data type JSONP   
        JSONP:" jsonpCallback ", // server parameters for the function name to receive callback calls   
        success:function(data){  
            $("#showcontent").text("Result:"+data.result)  
        },  
        error:function(){  
            alert('fail');  
        }  
    });   

Note abbreviated form, url = last? Symbol

Guess you like

Origin www.cnblogs.com/sangzs/p/11937376.html