function (Request) { request ("Helloworld.txt"). Then ( function(text) { Console.log ("The file ' s content is:" + text); }, function(error) { Console.log ("An error occurred:" + error); } );
function (Request) { request.post ("post-content.php", { data: { "blue", }, headers: { "x-something": "A value" } }). Then (function (text) { Console.log ("The server returned:", text); } );
Require (["Dojo/dom", "dojo/on", "Dojo/request", "dojo/domready!"], function(DOM, on, request) {//Results 'll be displayed in Resultdiv varResultdiv = Dom.byid ("Resultdiv"); //Attach The onclick event handler to the TextbuttonOn (Dom.byid ("Textbutton"), "click",function(evt) {//Request the text fileRequest.get (".. /resources/text/psalm_of_life.txt "). Then (function(response) {//Display The text file contentresultdiv.innerhtml = "<pre>" +response+ "</pre>"; }, function(Error) {//Display the error returnedresultdiv.innerhtml = "<div class=\" error\ ">" +error+ "<div>"; } ); }); });
Website address: http://dojotoolkit.org/documentation/tutorials/1.10/ajax/index.html
Dogo official translator Ajax with Dojo/request