1
我知道model/collection RESTful
的東西。但我需要在ampersand.js
中定製ajax
調用,但我似乎無法找到它的API
。我應該回到使用簡單的舊xmlhttprequest
而不是?在ampersand.js中自定義ajax調用
我知道model/collection RESTful
的東西。但我需要在ampersand.js
中定製ajax
調用,但我似乎無法找到它的API
。我應該回到使用簡單的舊xmlhttprequest
而不是?在ampersand.js中自定義ajax調用
如果自定義呼叫用於填充model/collection
,則應考慮使用ajaxConfig
選項。
否則,你可以只使用一個模塊一樣xhr
是ampersand-sync
使用本身,抽象的xmlhttprequest
,例如:
var xhr = require("xhr")
xhr({
body: someJSONString,
uri: "/foo",
headers: {
"Content-Type": "application/json"
}
}, function (err, resp, body) {
// check resp.statusCode
})
你能放置一個代碼示例 – SuperDJ
只是增加了一個代碼示例。 –