Hello,

I have a problem with an Ajax call on IE9.

I have searched the internet and this forum for solutions for a few hours and can't find an answer.

I have a coffee roastery site (developed with Codeigniter), where the users can order coffee bags online.

The user selects the blend and the quantity he wants and press a button to display the updated quantities on the right side of the screen.

Of course, works find everywhere besides IE9.

The problem is that in IE9 it just displays the last value the user added and not all the values that were there before. The page needs to be refreshed in order to see all the quantities added.

The jQuery code on the page:

<script type="text/javascript">
$(".grindform").submit(function() {
        var productId = $('#productId').val();
        var selected = $(this);
        var weight = $('#selectedWeight').val();
        var qtyEsp = $('#qtyEsp').val();
        var qtyFilter = $('#qtyFilter').val();
        var qtyPlunger = $('#qtyPlunger').val();
        var qtyTurkish = $('#qtyTurkish').val();
        var qtyBeans = $('#qtyBeans').val();
        var eroast = $('#eroast').val();
        var froast = $('#froast').val();
        var proast = $('#proast').val();
        var troast = $('#troast').val();
        var broast = $('#broast').val();


        $.ajax({
         type: "POST",
         url: "<?php echo base_url();?>order/orderonline/addCartItem",
         data: {productId: productId, weight: weight, ajax: '1', qtyEsp: qtyEsp, qtyFilter: qtyFilter, qtyPlunger: qtyPlunger, qtyTurkish: qtyTurkish, qtyBeans: qtyBeans, eroast: eroast, froast: froast, proast: proast, troast: troast, broast: broast},
         success: function(data){ 
            if(data == 'true')
                {
                $.get("<?php echo base_url(); ?>order/orderonline/showCart" + new Date().getTime(), function(cart)
                    {
                        console.log(cart);
                    $("#cartContent").html(cart);
                        selected.parent().slideToggle();
                    });

                    $('#k').show();
                    $('#g').show();
            }
                else if(data != '')
                {
                    $('#selectQty').html(data);
                }
                if(data == '')
                {
                alert("Product does not exist");
            }   
        }
    });

    return false;
});//End gform submit

Can someone please, please help me?

Recommended Answers

All 5 Replies

IE is sensitive to missing doctypes, unclosed tags and other minor Javascript typos. Make sure everything is in order. If you debug, do you see your data coming in?

Thank you.

I am getting this error:
SCRIPT65535: Invalid calling object
orderonline, line 1 character 1

My page is validated by the Markup validation service.

I've tried two doctypes, both give me the error:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">

and
<!DOCTYPE html> <html>

What am I doing wrong?

Another thing, when I check ie9 with F12, on the top it says:
Browser Mode: IE9 Document Mode: IE9 standards.

Don't know if it matters but I thought I should mention it.

After more reading, I did a few more things:
I've disabled the DIVX plugins in ie9
I've added this line first thing in the head tag:
<meta http-equiv="X-UA-Compatible" content="IE=9" />
Nothing helps :( Grrrrrrrrrrrrrrrrrrrrrr..... we should all ban IE from our websites. Put a big red message:

We do not support IE, please use a different browser.

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.