Dojo small example (33) dojo.request.script Implement cross-domain through JSONP

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});

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5780 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.