dogo 官方翻译 Ajax with dojo/request
require(["dojo/request"], function(request){
request("helloworld.txt").then(
function(text){
console.log("The file's content is: " + text);
},
function(error){
console.log("An error occurred: " + error);
}
);
});
require(["dojo/request"], function(request){
request.post("post-content.php", {
data: {
color: "blue",
answer: 42
},
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 will be displayed in resultDiv
var resultDiv = dom.byId("resultDiv"); // Attach the onclick event handler to the textButton
on(dom.byId("textButton"), "click", function(evt){
// Request the text file
request.get("../resources/text/psalm_of_life.txt").then(
function(response){
// Display the text file content
resultDiv.innerHTML = "<pre>"+response+"</pre>";
},
function(error){
// Display the error returned
resultDiv.innerHTML = "<div class=\"error\">"+error+"<div>";
}
);
});
}
);
官网地址:http://dojotoolkit.org/documentation/tutorials/1.10/ajax/index.html
dogo 官方翻译 Ajax with dojo/request的更多相关文章
- DOJO官方API翻译或解读-dojo/store (自定制存储器)
dojo/store 是对已存数据的访问和存储的统一接口,dojo/store意图以一个简单.易于使用和扩展的API来,替代.集合和改善 dojo/data 和dojox/storage .基于HTM ...
- dojo/request模块整体架构解析
总体说明 做前端当然少不了ajax的使用,使用dojo的童鞋都知道dojo是基于模块化管理的前端框架,其中对ajax的处理位于dojo/request模块.一般情况下我们使用ajax请求只需要引入do ...
- dojo/request
dojo/request模块整体架构解析 总体说明 做前端当然少不了ajax的使用,使用dojo的童鞋都知道dojo是基于模块化管理的前端框架,其中对ajax的处理位于dojo/request模块 ...
- ST官方翻译的中文应用笔记汇总
ST官方翻译的中文应用笔记汇总 http://www.51hei.com/stm32/3382.html 官方中文AN:AN3116:STM32? 的 ADC 模式及其应用AN1015:用于提高微控制 ...
- 【SFA官方翻译】使用 Kubernetes、Spring Boot 2.0 和 Docker 的微服务快速指南
[SFA官方翻译]使用 Kubernetes.Spring Boot 2.0 和 Docker 的微服务快速指南 原创: Darren Luo SpringForAll社区 今天 原文链接:https ...
- Netty5.x 和3.x、4.x的区别及注意事项(官方翻译)
Netty5.x 和3.x.4.x的区别及注意事项 (官方翻译) 本文档列出了Netty5新版本中值得注意变化和新特性列表.帮助你的应用更好的适应新的版本. 不像Netty3.x和4.x之间的变化 ...
- 用 dojo/request/script 玩垮域
dojo/request/script 可以用于向服务器发送跨域请求,如JSONP等.但单看官方文档有点不容易理解,特将体会记录. require(["dojo/request/script ...
- dojo 官方翻译 dojo/domReady 版本1.10
官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/domReady.html#dojo-domready dom加载完成后,执行. requi ...
- dojo 官方翻译 dojo/json 版本1.10
官方地址:http://dojotoolkit.org/reference-guide/1.10/dojo/json.html#dojo-json require(["dojo/json&q ...
随机推荐
- 使用NPOI导入Excel注意日期格式和数字格式
//使用NPOI导入Excel public static DataTable importExcelToDataSetUsingNPOI(string FilePath, string fileNa ...
- git 入门一(初识)
分布式版本控制系统 & 集中式版本控制系统 分布式版本控制系统( Distributed Version Control System)在这类系统中,像 Git,Mercurial,Baz ...
- JavaScript------Throw和Try-Catch的使用
function test() { try { var x = document.getElementById("demo").value; if (x == "&quo ...
- 第一篇:《UNIX 环境高级编程》编译环境的搭建
第一步:搭建基本的编译环境 安装gcc, g++, bulid-essential等编译软件 第二步:下载本书示例源码包 可在这里下载 www.apuenook.com 第三步:解压下载到的包并放在用 ...
- Yolo+Windows 配置(详细版)
一.配置环境 VS2013+显卡GtX1080ti+CUDA7.5+Opencv3.1.0+pthread pthread:ftp://sourceware.org/pub/pthreads-win ...
- Android实例-使用电话拨号器在移动设备上
Android实例-使用电话拨号器在移动设备上 源文地址: http://docwiki.embarcadero.com/RADStudio/XE5/en/Mobile_Tutorial:_Using ...
- 【BZOJ3207】花神的嘲讽计划Ⅰ Hash+主席树
[BZOJ3207]花神的嘲讽计划Ⅰ Description 背景 花神是神,一大癖好就是嘲讽大J,举例如下: “哎你傻不傻的![hqz:大笨J]” “这道题又被J屎过了!!” “J这程序怎么跑这么快 ...
- linux的bash与sh的区别
转自:https://zhidao.baidu.com/question/305415121.html https://zhidao.baidu.com/question/176780008.html ...
- 如何用redis来生成唯一Id
在之前的项目中需要用到一个自动增长的主键,该主键需要包含字母,所以没有办法用到数据库的自增主键.楼主要高手的指导下,发现Redis的RedisAtomicLong类可以解决这个麻烦.而且redis为单 ...
- eslint Rules
Rules 为了让你对规则有个更好的理解,ESLint 对其进行了分门别类. 所有的规则默认都是禁用的.在配置文件中,使用 "extends": "eslint:reco ...