在“;数据“;服务器端的标签-引导ajax调用
pass array in the "data" tag at server side - bootstrap ajax call
我无法确定是否可以在数据标记中发送数组:我的客户端JS代码看起来像:
$.ajax({
url: '/mobiledoc/jsp/aco/Beneficiary/ptmmview.jsp',
data: {
"action":"savePatientRecords",
"ptId":strPtId,
"PatientVal":PatientVal,
"Qid":Qid,
"QType":QType
"Array" : ??
},
dataType: 'text',
type: 'post',
success: function (responseMsg) {
// gets the response message back from server
loadMilestoneData();
alert(responseMsg);
服务器通常不会读取这样的数组。为了谨慎起见,请先在客户端上展平阵列:
data: {
...
"Array" : theArray.join(',') // beware of values with ',' in them
}
在服务器上,按","拆分阵列。
可以。首先使用方法,而不是类型帖子。像这样。。。
method: 'post'
JQuery应该为您序列化数据。
$.ajax({
url: '/mobiledoc/jsp/aco/Beneficiary/ptmmview.jsp',
data: {
"action": "savePatientRecords",
"ptId": strPtId,
"PatientVal": PatientVal,
"Qid": Qid,
"QType": QType,
"Array": [ 1, 2, 3 ]
},
dataType: 'text',
method: 'post',
success: function (responseMsg) {
// gets the response message back from server
loadMilestoneData();
alert(responseMsg);
}
});
如果没有,请使用JSON.stringfy将对象/数组转换为字符串。
$.ajax({
url: '/mobiledoc/jsp/aco/Beneficiary/ptmmview.jsp',
data: JSON.stringify({
"action": "savePatientRecords",
"ptId": strPtId,
"PatientVal": PatientVal,
"Qid": Qid,
"QType": QType,
"Array": [ 1, 2, 3 ]
}),
dataType: 'text',
method: 'post',
success: function (responseMsg) {
// gets the response message back from server
loadMilestoneData();
alert(responseMsg);
}
});
相关文章:
- 当查询不在displayField中时,引导Ajax Typeahead不显示结果
- Twitter引导模式通过Ajax更改内容
- 引导下拉列表动态 ajax 列表项
- 引导表单向导 - 防止在提交 ajax 响应的每个页面表单出现错误时滚动到下一步
- 如何在 ajax 成功中打开引导模式
- 用于确定 AJAX 调用的引导选项卡选择
- ajax引导模型
- 使用AJAX打开引导选项卡
- 无法通过Ajax加载引导工具提示
- 简介.js与引导模式和AJAX
- 如何获取按钮以在引导程序中触发 Ajax 请求
- 将 JSON 作为 HTML 中的资源加载以避免引导 ajax
- 将多个引导按钮与 jquery Ajax 结合使用
- Ajax 构建关系按钮有效,用于显示引导模式的第二个按钮有效,但两者不能协同工作
- 从弹出框内容引导 ajax 调用
- 在引导模式 - AJAX 中显示 JSON 数据
- 引导表单验证或必需不适用于 Ajax 提交
- 如何在中心显示带有消息的加载程序图像,并防止在 AJAX 响应来自 PHP 文件时关闭引导模式对话框
- 在“;数据“;服务器端的标签-引导ajax调用
- 在data-api中引导ajax设置