zhaowenyi713
|
|
« on: November 11, 2014, 06:01:05 PM » |
|
I find that submit method can't accept error event.When the program produce a bug (server 500), the success event will happen. I know EasyUI always validate mistake in validatebox, but some validate have to do in submit method(in back ground code,such as C# ,Java). When it's happen, I should catch and treat them. But now, because of current situation, I have to use $.ajax to submit my data in trouble. I have to collect data by explicit code.
so,for example,I have to submit my form data such as this type.
function save() {
var nameCN = $('#txt_NameCN').textbox('getValue'); var nameEN = $('#txt_NameEN').textbox('getValue'); var indexCode = $('#txt_IndexCode').textbox('getValue'); var remarks = $('#txt_Remarks').textbox('getValue');
var data = { NameCN: nameCN, NameEN: nameEN, IndexCode: indexCode, Remarks: remarks } $.ajax({ type: "POST", url: "/Kit/Save", data: data, dataType: "json", error: function (ajaxExceptionModel) { var obj = jQuery.parseJSON(ajaxExceptionModel.responseText); $.messager.alert('Error Info', obj.ErrorMessage, 'error'); }, success: function (operationResult) { showMessage("Save Successful"); } }); }
|