ajax
Description
Scheduler ajax 模块
ajax: any
Example
// 假设响应如下
{status: "ok", data: "value", data2: "value2"}
const xhr = scheduler.ajax;
// HTTP GET
xhr.get("server.php").then(function(response) {
const res = JSON.parse(response.responseText);
if (res && res.status == "ok") {
// 响应正常
}
});
// HTTP POST
xhr.post({
url:"server.php",
data: {
paramName: "paramValue"
}
}).then(function(response){
const res = JSON.parse(response.responseText);
if (res && res.status == "ok") {
// 响应正常
}
});