Jquery ajax using asp.net does not work on IE9 during the 2nd call of the function?

Posted by randelramirez1 on Stack Overflow See other posts from Stack Overflow or by randelramirez1
Published on 2012-10-22T16:41:58Z Indexed on 2012/10/22 17:01 UTC
Read the original article Hit count: 157

Filed under:
|
|

I have gridview that is loaded from another aspx page after an ajax call, the problem is it works on chrome/firefox/safari but using ie9 the ajax call would work fine during the first call but when i try to call the function again it throws an 304 status on the network tab of ie9 dev tool and the gridview is not refreshed.

Here is the jquery code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LoadCoursesGridViewHere.aspx.cs" Inherits="CoursesGridView" %>

<!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">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.8.2.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">


                <div id="Gridview-container">
                    <asp:GridView ID="GridView1" runat="server">
                    </asp:GridView>
                </div>
                <asp:TextBox ID="TextBox1" runat="server" ViewStateMode="Disabled"></asp:TextBox>

                <%-- <asp:Button Text="text" ID="btn" OnClientClick=" __doPostBack('UpdatePanel1', '')" runat="server" />--%>
                <input type="button" id="btn" value="insert"/>



    </form>

    <script type="text/javascript">

        $("#btn").click(function () {
            var a = $("#TextBox1").val();

            $.ajax({
                url: 'WebService.asmx/insert',
                data: "{ 'name': '" + a + "' }",
                contentType: "application/json; charset=utf-8",
                type: "POST",
                success: function () {

                    // alert('insert was performed.');
                    $("#Gridview-container").empty();
                    $("#Gridview-container").load("GridViewCourses.aspx #GridView1");



                }
            });

        });


    </script>
</body>

</html>

What happen is that after click the button it will insert the textbox value in the database through the webservice 'insert' and then reload the gridview that is placed inside a different aspx page. The problem is that when I ran it on IE9 during the 1st insert everything works properly but the succeeding inserts does reload the gridview and I noticed that it says '304' on the network tab of ie9 dev tool.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ASP.NET