<script type="text/javascript">
function submitcustomerservice()
{
var formArray = $('#addcustomerservicesform').serialize();
$.post('<?php echo base_url();?>index.php/home/save_customer_service', formArray, function (data) {
if (data.success) {
var customerid = $('#customerid').val();
window.location.replace('<?php echo base_url();?>index.php/home/customer_profile/' + customerid);
} else
{
for (var i in data.errors)
{
$('#' + i).validationEngine('showPrompt', data.errors[i], '', 'topRight', true);
}
for (var z in data.hidden)
{
$('#addcustomerservicesform #' + data.hidden[z]).validationEngine('hide');
}
}
}, 'json');
return false;
}
This above code is triggered when I hit my save button, it is supposed to check and save all data in the form, upon adding data['success']
is set to true, and if there are any errors data['errors']
is set to respective errors. I have it working on the localhost but when I uploaded to my main website it is giving me error of data is null
. Please let me know what you think about it. What might be a possible problem here?