gpt4 book ai didi

javascript - 道场 : How to make PUT request on jsonRest store with callback method

转载 作者:行者123 更新时间:2023-11-30 13:20:26 25 4
gpt4 key购买 nike

我正在使用 Dojo JsonREST 存储与服务器上的 RESTful API 进行通信。 GET 和 QUERY 方法与异步回调处理程序配合得很好。然而,在 JsonREST 存储上发布新对象的 PUT 请求似乎没有异步回调功能。这样就不可能仅在 PUT 请求已完成并成功时才触发事件。

来自文档 (http://dojotoolkit.org/reference-guide/1.7/dojo/store/JsonRest.html):

 require(["dojo/store/JsonRest"], function(JsonRestStore){
var store = new JsonRestStore({target: "/Table/" });

store.get(3).then(function(object){
// CALLBACK HERE :-)
});

store.query("foo=bar").then(function(results){
// CALLBACK HERE :-)
});

store.put({ foo: "bar" }, { id: 3 }); // NO CALLBACK CAPABILITIES ???

store.remove(3); // NO CALLBACK CAPABILITIES ???
});

有什么想法吗?

谢谢

最佳答案

你试过使用 store.put({ foo: "bar"}, { id: 3 }).then(function(){});, store.remove( 3).then(函数(){}); ?检查these docsthis post .

关于javascript - 道场 : How to make PUT request on jsonRest store with callback method,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10385807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com