jquery - Knockout bindings not updating in IE 8 -
i have page displays list of items in db , text box add new new item. when page first rendered list displayed in ie, when add new item list not updated in ie 8. works correctly in chrome. here code:
self.listofdepartments.getlistofalldepartments = function () { $.getjson('/department/listalldepartments', function (data) { var mapped = ko.mapping.fromjs(data); self.listofdepartments(mapped); }); }; self.adddepartmentmodel.adddepartment = function () { self.errors = ko.validation.group(this, { deep: true, observable: false }); if (self.adddepartmentmodel.errors().length == 0) { $.ajax({ url: "/department/add/", type: 'post', data: ko.tojson(self.adddepartmentmodel), contenttype: 'application/json', success: function (result) { $('#success').html('department added successfully.'); $("#success").dialog({ dialogclass: 'noclose', autoopen: true, show: "blind", hide: "explode", modal: true, open: function(event, ui) { settimeout(function() { $('#success').dialog('close'); }, 3000); } }); department.departmentname(null); department.departmentname.ismodified(false); self.listofdepartments.getlistofalldepartments(); } }); } else { self.adddepartmentmodel.errors.showallmessages(); return; } };
html:
<div data-bind="foreach: listofdepartments()"> <div data-bind="text: departmentname" class="margin textstyle"></div> </div>
when getlistofalldepartments called if add successful list of page not update in ie. there special needs done ie?
found solution. ie caching ajax requests turn off caching:
$.ajaxsetup({ cache: false });
Comments
Post a Comment