これが私のソースコードです:
<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>
しかし、ボタンを押してデータをサーバーに投稿しようとすると、firebugは次のように言います。
_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」が必要です。それで、多分私はいくつかの他のモジュールまたはクラスを必要とするべきですか?