这是我的源代码:
<script>
function sendText(){
require([ "dijit/form/Button", "dojo/_base/xhr"],
function(Button,xhr) {
xhr.post({
url: "validURL1.html",
form: dojo.byId("myForm"),
load: function(data){
var newStore =
new ItemFileWriteStore({url:'validURL2.html'});
dijit.byId("grid").setStore(newStore);
},
error: function(error){
alert("error!");
}
});
});
}
</script>
<button data-dojo-type='dijit.form.Button' onClick ='sendText()'>submit</button>
但是当我按下按钮并尝试将我的数据发布到服务器时,萤火虫说:
_145 未定义
那么我的代码有什么问题?什么是错误'_145'?
更新
<script>
require([ "dijit/form/Button", "dojo/_base/xhr","dijit/form/Form", "dojo/data/ItemFileWriteStore",
"dojo/dom-form","dijit/registry","dojo/ready", "dojox/grid/EnhancedGrid"],
function(Button,xhr, Form, ItemFileWriteStore, domForm, registry,ready, EnhancedGrid) {
var hasBeenSent = false;
window.sendText = function() {
xhr.post({
url: "validURL1.html",
form: dojo.byId("myForm"),
handleaAs: "text",
load: function(data) {
var newStore = new ItemFileWriteStore({url:'validURL2.html'});
dojo.byId("grid").setStore(newStore);
},
error: function(error){
alert("error!");
},
handle: function() {
hasBeenSent = true;
}
});
}
});
</script>
现在它说:
TypeError: dojo.byId("grid").setStore is not a function
但是,我需要“enhancedGrid”。所以也许我应该需要一些其他的模块或类?