Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.14.255.58
function callcollbankdet()
{
$("#page_main_div").load('html_modules/collbankdet.html',function(){
document.getElementById('display_module_name').innerHTML = 'College Bank Details';
document.getElementById('module_name_for_save').value = 'Update College Bank Details';
getDefaultHeadFooterLinks('Update College Bank Details');
var datastring = '';
$.ajax({
type: "POST",
data:datastring,
url:$host_url+'getbankdet',
success: function(responce)
{
responce = eval('(' + responce + ')');
$("#collbankdet input[type=text], #collbankdet textarea").each(function(l)
{
$(this).val(responce.data[$(this).attr('id')]);
});
}
});
});
}
function Savecollbankdet()
{
var jsonObj = [];
var cntrdetlobj = '';
var missing_fields = [];
$("#collbankdet input[type=text],#collbankdet select,#collbankdet textarea").each(function(){
item = {};
item ["id"] = $(this).attr('id');
item ["value"] = $(this).val();
item ["value"] = item["value"].replace('&',"and");
item ["value"] = item["value"].replace('"',"`");
item ["value"] = item["value"].replace("'","`");
jsonObj.push(item);
if($(this).val() == '')
{
missing_fields.push($(this).attr('name'));
}
});
var html_string = '';
var i = 1;
for(let field of missing_fields)
{
html_string += `\t ${i} ${field} \n`;
i++;
}
var msg = "The Following fields are missing \n";
if(missing_fields.length > 0)
{
msg += ` ${html_string}`;
alert(msg);
//return;
}
cntrdetlobj = JSON.stringify(jsonObj);
var datastring = 'cntrdetlobj='+cntrdetlobj;
$.ajax({
type: "POST",
data:datastring,
url:$host_url+'Savecollbankdet',
success: function(responce)
{
responce = eval('(' + responce + ')');
if(responce.error_code === -1)
{
alert('Updation Failed');
return;
}
else
{
alert('Updated successfuly.');
callcollbankdet();
}
}
});
}
|