dojo/request/script implements cross-domain request data through JSONP, and requires back-end cooperation to return Javascript code:
require(["dojo/request /script", "dojo/json"],function(script, JSON) {script.get(url, {handleAs: "json", jsonp:'jsonpcallback' }).then(function(data) {console.log( JSON.stringify(data)); });});
The form of request url:
http://url?param=bgh&jsonpcallback=dojo_request_script_callbacks.dojo_request_script0
< /p>
The response header information contains this content:
Content-Type: application/javascript;charset=UTF-8
response Content:
dojo_request_script_callbacks.dojo_request_script0({"name":"bgh","note": "","success":true});
dojo_request_script_callbacks.dojo_request_script0({"name":"bgh","note":""," success":true});