Extjs 如何使用Ext.Ajax.request将数组发送到Jsp?
我的HTML文件中有一个数组,希望在按钮提交时使用Ext.Ajax.request将其发送到Jsp文件。。。 我的代码是:Extjs 如何使用Ext.Ajax.request将数组发送到Jsp?,extjs,extjs4,Extjs,Extjs4,我的HTML文件中有一个数组,希望在按钮提交时使用Ext.Ajax.request将其发送到Jsp文件。。。 我的代码是: Ext.onReady(function() { Ext.create('Ext.data.Store', { storeId:'myArray', fields:['id','name', 'email'], data:{'items':[ {"id":"1", "name":"Lisa", "email":"lisa@ArrayD
Ext.onReady(function() {
Ext.create('Ext.data.Store', {
storeId:'myArray',
fields:['id','name', 'email'],
data:{'items':[
{"id":"1", "name":"Lisa", "email":"lisa@ArrayData.com"},
{"id":"2", "name":"Bart", "email":"bart@ArrayData.com"},
{"id":"3", "name":"Homer", "email":"home@ArrayData.com"},
{"id":"4", "name":"Marge", "email":"marge@ArrayData.com"}
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
Ext.create('Ext.Button', {
text: 'Click me',
renderTo: Ext.getBody(),
handler: function() {
{
Ext.Ajax.request({
url: 'prac.jsp',
method: 'POST',
jsonData: myArray,
success: function() {
console.log('success');
},
failure: function() {
console.log('woops');
}
});
}
}
});
});
我在Firebug中有一个错误:
太多的递归
返回toString.callvalue==='[对象日期]' 我发布了实际代码的错误部分。真的很抱歉给你带来困惑。。。工作代码为:
Ext.onReady(function() {
var array_edited=Ext.create('Ext.data.Store', {
storeId:'myArray_edited',
fields:['id','name', 'email'],
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
Ext.create('Ext.Button', {
text: 'Click me',
renderTo: Ext.getBody(),
handler: function() {
{
Ext.Ajax.request({
url: 'newjsp.jsp',
method: 'POST',
params: {arr: array_edited},
callback: function (options, success, response) {
if (success) {
var json = Ext.JSON.decode(response.responseText);
Ext.MessageBox.alert('Add Profile Info', json.msg);
}
},
//jsonData: array_edited,
success: function() {
console.log('success');
},
failure: function() {
console.log('woops');
}
});
}
}
});
});
您的问题可能与ajax调用无关,而是与包含return-toString.callvalue===='[object-Date]';的内容有关;。那在哪里?@rob that toString.callvalue==='[对象日期];不在我的代码中。。它位于ext-all-debug.js第329行。我不知道这里发生了什么..数组变量的定义在哪里?这是如何回答这个问题的?你从未发布过myArray或array_编辑的内容。我也不认为这是这个问题的答案。在回答新问题之前,你应该先编辑你的问题。