hi guys,
I just wanna ask a question
I have 6 function, add/edit/save for user and add/edit/save for clinic here's the code
for users
function newUser(){
$('#dlg').dialog('open').dialog({
title: 'New Vet',
width: 1344,
height: 635,
closed: false,
cache: false,
modal: true,
resizable: true
});
$('#fm').form('clear');
url1 = 'save-vet.html';
//........
function editUser(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#dg2').datagrid({
url:'get-clinic.html?clinid='+row.system_md_id
});
$('#dlg').dialog('open').dialog({
title: 'Edit Vet',
width: 1344,
height: 635,
closed: false,
cache: false,
modal: true,
resizable: true
});
$('#fm').form('load',row);
url1 = 'update-vet.html?id='+row.system_md_id;
//........
function saveUser(){
$('#fm').form('submit',{
url: url1,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = eval('('+result+')');
if (result.errorMsg){
$.messager.show({
title: 'Error',
msg: result.errorMsg
});
} else {
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload'); // reload the user data
$('#dg').datagrid('reload'); // reload the user data
}
}
});
}
for clinic
function newclinic(){
$('#clinimain').dialog('open').dialog({
title: 'Add Clinic',
width: 500,
height: 500,
closed: false,
cache: false,
modal: true,
resizable: true,
closable: false
});
$('.clearinfo').val("");
url2 = 'save-clinic.html';
}
function editclinic(id){
var row = $('#dg2').datagrid('getSelected');
if (row){
$('#clinimain').dialog('open').dialog({
title: 'Edit Clinic',
width: 500,
height: 500,
closed: false,
cache: false,
modal: true,
resizable: true,
closable: false
});
$('#fm2').form('load',row);
url2 = 'update-clinic.html?id='+row.system_company_clinic_id;
}else{
alert("Please Select A Record To Modify!");
}
}
function saveClinic(){
$('#fm2').form('submit',{
url: url2,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = eval('('+result+')');
if (result.errorMsg){
$.messager.show({
title: 'Error',
msg: result.errorMsg
});
} else {
$('#clinimain').dialog('close'); // close the dialog
$('#dg2').datagrid('reload'); // reload the user data
$('#dg2').datagrid('reload'); // reload the user data
}
}
});
}
My question is I change variable url in add/edit for each account into url1 for user and url2 for clinics , is it safe to change these variable?
thank you very much!