We are developing an application in ASP.Net MVC 3 using jQuery UI Dialog.
This is our generic dialog code:
var $loading = $('<img src="' + srcLoadingImage + '" alt="loading">');
$(aElement).each(function () {
var $dialog = $(divTarget)
.append($loading.clone());
var $link = $(this).click(function () {
$dialog
.load($link.attr('href'))
.dialog({
modal: true,
title: $link.attr('title'),
width: 350,
height: 240
});
$link.click(function () {
$dialog.dialog('open');
return false;
});
return false;
});
});
which we call like so..
$(document).ready(function () {
RTC.Utils.aDialog('#selectAccount', '<div class="span-9"></div>', '@Url.Content("~/Content/images/loading.gif")');
});
The problem we are running into is that in Firefox everything works great.. but in IE7 the controller is only ever called the first time you access it. After that it seems to be using the original version.
Do you need to manually destroy the dialog for IE7 to work properly? Any pointers on how I’d do so?
— UPDATE —
We removed the One() as per ammura’s suggestion but we still have the same problem.
We have also tried adding close: function(ev, ui) { $(this).dialog(“destroy”); } after the height in dialog({ but with no effect.
Thanks,
Shane
You can tell jquery to not cache ajax requests, as James H’s answer shows. I’ve never been a fan of this as jquery will append a meaningless argument to the GET request. It feels hackish and possibly even bug prone to me.
I have found that adding
[OutputCache(Duration=0)]to the action in question works for me. It forces a true GET for each AJAX call. In my case I never want this call to ever be cached, as the data changes often.