0
 <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?

4

1 回答 1

0

Probably the page it is requesting is not actually working like you think it is.

Install firebug, and watch the net tab. Then take a look at what the actual page is returning.

BTW Are you sure about the base_url() function? You probably don't need it - you can do a relative url.

于 2012-07-16T08:41:39.537 回答