[英]Ajax IE7 non stop reloading issues
我正在使用AJAX并同时执行一些javascript / jquery。 我正在使用.load()。 现在,我在IE7上遇到问题,每个浏览器都能正常运行。 IE7不知何故一直不断地重新加载相同的内容。
我尝试使用
$.ajaxSetup({
cache: false
});
和
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
没有任何工作。
我真的不知道发生了什么,也找不到任何解决方案。
希望你们能帮助我。 提前致谢。
我的AJAX代码:
$('#ir_content').load(pageurl + ' #ir_inner_content');
并且由于另一个文件使用的是带有后端语言的手动编码的javascript,所以我通过在img标签的1个上使用onload来运行脚本:
<img src="/images/icon_loadingLarge.gif" width="32" height="32" alt="loading..." id="loading_indicator" style="display: none;" onload="var script_text = $('#webchart_js').html(); eval(script_text);" />
script_text:
<div id="webchart_js">
(function($){
var interactive_chart_config = {
zoom_historical_default: [% chart_config.chart.chart_interactive.zoom_historical_default %],
zoom_intraday_default: [% chart_config.chart.chart_interactive.zoom_intraday_default %],
quotes_delay: [% ir.var.Config.format.quotes_delay %],
news_on_chart: {
[% news_types = chart_config.chart.chart_interactive.news_on_chart.keys %]
[% FOREACH news_type = news_types %]
[% news_type %]: {
[% news_options = chart_config.chart.chart_interactive.news_on_chart.${news_type}.keys %]
[% FOREACH news_option = news_options %]
[% news_option %]: [% chart_config.chart.chart_interactive.news_on_chart.${news_type}.${news_option} ? 'true' : 'false' %][% IF news_option != news_options.last %],[% END %]
[% END %]
}[% IF news_type != news_types.last %],[% END %]
[% END %]
},
modify_news: [
[% FOREACH news = chart_config.chart.chart_interactive.modify_news.news %]
{
[% FOREACH key = news.keys %]
[% key %]: '[% news.${key} %]'[% IF key != news.keys.last %],[% END %]
[% END %]
}[% IF news != chart_config.chart.chart_interactive.modify_news.news.last %],[% END %]
[% END %]
]
};
$(document).ready(function(){
$('#content_container').web_chart($.extend({}, {
theme : Highcharts.theme,
counter_code : "[%= stock_ids.first %]",
plot_on_load : true,
always_reload : true,
loading_indicator_id : 'loading_indicator',
chart_setting_id : 'chart_setting',
counter_list_form_id : 'counter_list_form',
chart_container_id : 'chart_container',
css_class_for_flags : {'N' : 'news_tooltip', 'I' : 'insider_trades_tooltip', 'C' : 'corporate_actions_tooltip'}
}, interactive_chart_config));
});
})(jQuery);
</div>
尝试在ajax URL的末尾添加一个随机字符串。 这将停止IE缓存内容。 像这样:
$('#ir_content').load(pageurl + '?r=' + Math.Random() + '#ir_inner_content');
什么是always_reload
? 通过将其传递为true,是否有可能重新加载IE7?
$(document).ready(function(){
$('#content_container').web_chart($.extend({}, {
theme : Highcharts.theme,
counter_code : "[%= stock_ids.first %]",
plot_on_load : true,
/*
* HERE
*/
always_reload : true,
loading_indicator_id : 'loading_indicator',
chart_setting_id : 'chart_setting',
counter_list_form_id : 'counter_list_form',
chart_container_id : 'chart_container',
css_class_for_flags : {'N' : 'news_tooltip', 'I' : 'insider_trades_tooltip', 'C' : 'corporate_actions_tooltip'}
}, interactive_chart_config));
});
})(jQuery);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.