0
Good morning!
Guys, I’m a beginner in javascript and I have some questions about the section below:
var url;
function newUser(){
$('#dlg').dialog('open').dialog('setTitle','Novo Cliente');
$('#fm').form('clear');
url = 'salvar_cadastroclientes.php';
}
function saveUser(){
$('#fm').form('submit',{
url: url,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = eval('('+result+')');
if (result.success){
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload'); // reload the user data
} else {
$.messager.show({
title: 'Erro',
msg: result.msg
});
}
}
});
}
In the save function, the code is capturing the submit
of form
.
And on the second line, what is this url: url
, onSubmit
... ?
It is the form action. Where to go when Submit is given.
– Raylan Soares
That one
.form()
is of some plugin? in this case which?– Sergio
The doubt is not about the language but about the algorithm.
– RBoschini
exact, the doubt is about what makes this URL: URL, onsubmit :[] , Success: []
– Rafael Eduardo Cabrera