Jsonp error unexpected token

! DOCTYPE html >
< html lang= "en" >
< head >

<meta charset="UTF-8">
<title></title>
<script src="https://cdn.jsdelivr.net/npm/vue" defer="defer"></script>
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>

< / head >
< body >
< script >
$.ajax ({

)
        type : "get",
        async:false,
        url : "http://7bv7bi.com1.z0.glb.clouddn.com/getOrderList.json",
        dataType : "jsonp",
        jsonp: "callback",
        jsonpCallback:"jsonpCallback",
        success : function(data){
                alert("success")
            },
        error: function( ) {
            alert("false")
        }
    });

< / script >
< / body >
< / html >
this always tells you what"s wrong with unexpected token,

Feb.28,2021

the address you requested is in json format, not when the script


uses jquery to jsonp to obtain data. The data format returned by the backend must be jsonpCallback ({.}), so your url, That is, there is a problem with the format of the data returned by http://7bv7bi.com1.z0.glb.clo..


your url: "http://7bv7bi.com1.z0.glb.clouddn.com/getOrderList.json" points to a json file. Please check the contents of the json file


the reason is that the data format you requested is in json format instead of jsonp format. Change it to the following code and you can use it

.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://cdn.jsdelivr.net/npm/vue" defer="defer"></script>
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<script>
$.ajax({

        type : "get",
        async:false,
        url : "http://7bv7bi.com1.z0.glb.clouddn.com/getOrderList.json",
        dataType : "json",
        // jsonp: "callback",
        // jsonpCallback:"jsonpCallback",
        success : function(data){
            alert("success");
            alert(JSON.stringify(data))
            console.log(data);
        },
        error: function( ) {
            alert("false")
        }
    });
</script>
</body>
</html>
Menu