tags:

views:

10

answers:

1

I want to fetch record from controller this code work fine on page ready event, but with i save new record and want to fetch list of new record, code return old record...

function FetchMessage(Id) {

        $("#SearchResult").empty();
        $.getJSON("/home/BusinessMessages", { busId: Id }, function (data) {

            for (var i = 0; i < data.length; i++) {
                $("#SearchResult").append('<div> <div class="nameHd">' + data[i].messagebody + '<div class="icon"><img src="../../Content/images/arrow-msg.gif" alt="" /></div></div><div class="imgBox"><img src="' + data[i].imageurl + '" alt="" /></div></div><div class="clr"></div>');
            }
            $("#record").html(data.length + " messages");
        });
    }


    Function BusinessMessages(ByVal busID As String) As JsonResult
        Return Json(home.GetMessageByBusId(busID),JsonRequestBehavior.AllowGet)
    End Function
+2  A: 

I am sure it is happening in IE. The reason is IE is caching the response and getJSON will not allow to set cache to false. Change your code to use .ajax method and set dataType to json and set cache to false.

Teja Kantamneni