I have a .csHtml page. The page is populated by calling a method in the contoller using Jquery $.get. The method in the controller makes a database call and returns a partial view. The partial view is rendered inside a DIV tag.
The data is being displayed real time. Now when I hit ctrl + f5, the page refreshes, but it still shows the same data. I put a breakpoint in the controller method and realized that the method in controller is not being called.
The first time the method is being called when I hit F5 and run in Visual Studio. The second time when I refresh the data is not being refreshed.
If I have to see any changes being displayed in the database, I need to restart the visual studio.
Any clue on what could be happenning?? Below is the snippet of code.
// Our onReady actions;
$(document).ready(function () {
$('#RateTab').click(function () {
getRates();
});
});
function getRates() {
var URL = "home/Rates";
$.get(URL, function (data) {
$('#loading').hide();
$("#rates").html(data);
//Initialize();
});
}
Any ideas and suggestions on what could be happenning ??
I think it's a cache that is enabled. You can control cache by using the $.ajax
method. Try to rewrite it like that :
$.ajax({
url : URL,
type : 'GET',
cache : false,
success : function (data) {
$('#loading').hide();
$("#rates").html(data);}
});
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With