Home >Web Front-end >JS Tutorial >Example sharing of form submission in EasyUI_jquery

Example sharing of form submission in EasyUI_jquery

WBOY
WBOYOriginal
2016-05-16 16:11:49998browse

Copy code The code is as follows:

$('#form').form({
url: 'test/add.do',
onSubmit : function() {
parent.$.messager.progress({
Title: 'Tips',
Text: 'Data processing, please wait....'
});
var gridValid = endEdit();//Sub table exits editing verification
if (!gridValid) {
parent.$.messager.progress('close');
Return false;
}
var isValid = $('#form').form('validate');
if (!isValid) {
parent.$.messager.progress('close');
Return false;
}
// Write the added, modified, and deleted data in the subtable to the hidden input
accept();
Return true;
},
success : function(result) {
parent.$.messager.progress('close');
Try {
Data = eval("(" result ")");// Convert JSON string into object
If (data && data.success) {
If (data.msg && data.msg != "")
       parent.$.messager.alert('prompt', data.msg);
      else
       parent.$.messager.alert('prompt', "Added successfully");
Parent.$.modalDialog.openner_grid.datagrid('reload');// Refresh Gird data
​ parent.$.modalDialog.handler.dialog('close');//Close the current modal window
} else
Parent.$.messager.alert('error', data.msg); // Operation failed
} catch (e) {
Parent.$.errorDialog(result);// Prompt server exception
}
}
});

The above is the entire content of this article, I hope it can be helpful to everyone.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn