Play with Dojo/request/script

Source: Internet
Author: User

Dojo/request/script can be used to send cross-domain requests to the server, such as JSONP. But looking at official documents is a bit difficult to understand and will experience the record.

Require(["Dojo/request/script"],function(Script){Script.Get("Something.js",{Jsonp:"Callback"}).Then(function(Data) {//On_successDo something with the response data},function(Err) {//On_errorHandle the error condition});Progress Events is not supported})

Script.get (URL, option);
Where the Option field is:
Checkstring: "somestring",//The server returns a section of JS code defined a variable somestring, the browser to determine whether the variable is defined to determine whether the successful execution. On_success does not transmit data inside.
JSONP: "Cb_name",//The browser sends a field similar to Cb_name=dojo_request_script_callbacks.dojo_request_script0 to the server,
Server returnsdojo_request_script_callbacks.dojo_request_script0(...) The invocation statement is for the browser to execute, and the calling parameter is the on_success data. If you need to perform the
Call, then in the on_success inside their own manual call, why do you love.
Query: "somestring" or objcect,//The browser sends the corresponding parameter to the server, the server returns the statements are eval, but on_success does not send data.
The other two fields are TimeOut, Preventcache easy to understand.
  

Play with Dojo/request/script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.