1
我找不到這個地方,我不知道爲什麼跨域REST請求沒有被dojo解決。無論如何是這樣的問題:使用JSONP將WCF跨域使用存儲在數據網格中並查看數據dojo?
我正在實施dojo數據網格,我試圖從WCF不在我的域中獲取網格的數據,所以我crossdomain問題引發,我試圖通過使用JSONP來解決這個問題。
但我是道場的新手,所以我可能做錯了什麼。這裏是我的代碼:
require([
"dojo/store/JsonRest",
"dojo/store/Memory",
"dojo/store/Cache",
"dojox/grid/DataGrid",
"dojo/data/ObjectStore",
"dojo/query",
"dijit/form/Button",
"dojo/domReady!",
"dojo/request/script","dojo/dom-construct"
],function(script, domConstruct){
//make the request just as before
script.get("http://localhost:8060/ListService.svc/LoadLists?uid=c4446476-15e6-e111-9ecb-b7c5971d170a", {
jsonp: "callback",
query: {q: "#dojo"}
}).then(function(data){
test = data;
}).then(function(){
console.log(results);
});
}, function (JsonRest, Memory, Cache, DataGrid, ObjectStore ,query) {
grid = new DataGrid({
store: dataStore = test,
structure: [
{ name: "Blog Id", field: "id", width: "50px", },
{ name: "Name", field: "listtype", width: "200px",classes:"Name" },
{ name: "Phone Number", field: "longlevel", width: "200px",classes:"test" }
]
}, "gridTest"); // make sure you have a target HTML element with this id
grid.startup();
dojo.query("body").addClass("claro");
grid.canSort = function() { return false; };
});
我得到的錯誤是查詢不是一個函數。任何想法如何正確實施。