form内控件参数自动添加到url后,而自定义的url参数则不能添加到url后
$(‘#fm‘).form(‘submit‘, {
url: ‘Data/Diary.ashx?dt=‘ + new Date() + ‘&operation=save‘, operation参数在后台无法得到,换一种提交方式
onSubmit: function () {
return $(this).form(‘validate‘);
},
success: function (result) {
$.messager.alert("提示信息", result.msg);
closeDiary();
$(‘#divDatagrid‘).datagrid(‘reload‘);
}
});
换一种提交方式
$.ajax({
url: ‘Data/Diary.ashx‘,
Type: ‘POST‘,
dataType: ‘json‘,
data: { dt: new Date(), operation: "save", title: $(‘#title‘).val(), content: $(‘#content‘).val(), id: $(‘#hidDiaryId‘).val() },
success: function (result) {
if (result.isok) {
$.messager.alert("提示信息", result.msg);
closeDiary();
$(‘#divDatagrid‘).datagrid(‘reload‘);
} else {
$.messager.alert("提示信息",result.msg);
}
}
});