表单提交
<
form
method
=
"post"
action
=
"${BASE_PATH}/member/addMember"
class
=
"pageForm -validate"
onsubmit
=
"return validateCallback(this, dialogAjaxDone);"
>
用IE浏览器,前台直接就输出json格式
{ "statusCode":"200","message":"操作成功","navTabId":"listMember","rel":"","callbackType":"closeCurrent","forwardUrl":"","confirmMsg":"" }
在 dwz.ajax.js 的validateCallback 中,应为有验证 form.valid() 方法造成的
function
validateCallback(form, callback, confirmMsg) {
var
$form = $(form);
if
(!$form.valid()) {
return
false
;
}
var
_submitFn =
function
(){
$.ajax({
type: form.method ||
'POST'
,
url:$form.attr(
"action"
),
data:$form.serializeArray(),
dataType:
"json"
,
cache:
false
,
success: callback || DWZ.ajaxDone,
error: DWZ.ajaxError
});
};
if
(confirmMsg) {
alertMsg.confirm(confirmMsg, {okCall: _submitFn});
}
else
{
_submitFn();
}
return
false
;
}
解决办法
去掉 form 表单的 onSubmit 或直接 return false
1
|
<
form
id
=
"form0"
method
=
"post"
action
=
"${BASE_PATH}/member/addMember"
class="pageForm -validate>
|
<
button
type
=
"button"
onclick
=
"validateCallback('#form0', dialogAjaxDone);"
>保存</
button
>