Hi guys,
I am getting very weird issue here. On my wampserver, this script works fine but not on my liver server which is linux. This is what it does. After a checkbox gets checked, the scripts identifies that and insert a row in table and that script send back a notification saying "new row entered". On my local wamp, it works fine but on the live server, it is able track my checkbox checking, it inserts the record too but, the checkbox doesn't it is being checked. below is the jQuery for it.

<script type="text/javascript">
/* adding category on each click*/
    $('#post_cat_id2').click(function() {
        if($(this).prop('checked') == true)
        {
            var form_data   =   {
                post_cat_id: $('#post_cat_id2').val(),
                action: 'add'
            };
            $.ajax({
                url: "http://localhost/MIS_ServerCopy/index.php/posts/ajax_set_categorytopost",
                type: 'POST',
                data: form_data,
                success: function(msg){
                    $('#Postsnotifications').hide().html(msg).fadeIn('slow'); //appending newly added categories, in
                    $('#post_cat_id2').prop('checked', 'checked');
                }
            });
        }
        else
        {
            var form_data   =   {
                post_cat_id: $('#post_cat_id2').val(),
                action: 'add'
            };

            $.ajax({
                url: "http://localhost/MIS_ServerCopy/index.php/posts/ajax_set_categorytopost",
                type: 'POST',
                data: form_data,
                success: function(msg){
                    $('#Postsnotifications').hide().html(msg).fadeIn('slow'); //appending newly added categories, in
                    $('#post_cat_id2').prop('checked', false);
                }
            }); 
        }
    return false;
});
</script>
Member Avatar for LastMitch

This is what it does. After a checkbox gets checked, the scripts identifies that and insert a row in table and that script send back a notification saying "new row entered". On my local wamp, it works fine but on the live server, it is able track my checkbox checking, it inserts the record too but, the checkbox doesn't it is being checked. below is the jQuery for it.

There's nothing wrong with your Ajax code.

You need to add cache in your Ajax code.

I think you need to double check your words in your code that you have and compare with the words in your code on the html side also any entities (missed a period or comma and etc).

That's the only thing I can think of because you only provided Ajax code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.