Javascript Ajax IE7不间断重新加载问题
我正在使用AJAX,同时执行一些javascripts/jquery。我正在使用.load()。现在我在IE7上遇到了问题,每个浏览器都可以正常工作。不知何故,IE7总是不停地一次又一次地重新加载相同的内容 我试过使用Javascript Ajax IE7不间断重新加载问题,javascript,ajax,internet-explorer-7,Javascript,Ajax,Internet Explorer 7,我正在使用AJAX,同时执行一些javascripts/jquery。我正在使用.load()。现在我在IE7上遇到了问题,每个浏览器都可以正常工作。不知何故,IE7总是不停地一次又一次地重新加载相同的内容 我试过使用 $.ajaxSetup({ cache: false }); 及 因为另一个文件使用的是带有后端语言的手动编码javascript,所以我在img标记的1上使用onload运行脚本: <img src="/images/icon_loadingLarge.gif"
$.ajaxSetup({
cache: false
});
及
因为另一个文件使用的是带有后端语言的手动编码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);" />
脚本和文本:
<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>
(函数($){
变量交互式图表配置={
缩放历史默认值:[%chart\u config.chart.chart\u interactive.zoom\u historical\u default%],
zoom_intraday_default:[%chart_config.chart.chart_interactive.zoom_intraday_default%],
quotes\u delay:[%ir.var.Config.format.quotes\u delay%],
图表上的新闻:{
[%news\u types=chart\u config.chart.chart\u interactive.news\u on\u chart.keys%]
[%FOREACH新闻类型=新闻类型%]
[%news\u type%]:{
[%news\u options=chart\u config.chart.chart\u interactive.news\u on\u chart.${news\u type}.keys%]
[%FOREACH news\u option=news\u options%]
[%news\u option%]:[%chart\u config.chart.chart\u interactive.news\u on\u chart.${news\u type}.${news\u option}?'true':'false%][%IF news\u option!=news\u options.last%],[%END%]
[%END%]
}[%IF news\u type!=news\u types.last%],[%END%]
[%END%]
},
修改新闻:[
[%FOREACH news=chart\u config.chart.chart\u interactive.modify\u news.news%]
{
[%FOREACH key=news.keys%]
[%key%]:“[%news.${key}%]”[%IF key!=news.keys.last%],[%END%]
[%END%]
}[%IF news!=chart\u config.chart.chart\u interactive.modify\u news.news.last%],[%END%]
[%END%]
]
};
$(文档).ready(函数(){
$('content_container').web_图表($.extend({}{
主题:Highcharts.theme,
计数器代码:“[%=股票ID.first%]”,
加载时的绘图:正确,
总是:对,
正在加载指示器\u id:“正在加载指示器”,
图表设置\u id:“图表设置”,
计数器列表表单id:“计数器列表表单”,
图表容器id:“图表容器”,
css_类_用于_标志:{'N':'news_tooltip','I':'insider_trades_tooltip','C':'corporate_actions_tooltip'}
},交互式图表(配置);
});
})(jQuery);
尝试在ajax URL的末尾添加一个随机字符串。这将停止IE缓存内容。像这样:
$('ir#u content').load(pageurl+'?r='+Math.Random()+''ir#u internal_content')代码>什么是“总是重新加载”
?通过将其传递为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);
您的ajax代码是什么?如何触发负载?给我们你的代码。嗨,乔德夫,谢谢你的帮助。我已经在上面插入了我的代码,不知道这是否足够=我很确定图像的
onload
属性不是必需的。我认为将方法更改为Ajax调用,如$.Ajax({})代码>可能有用。script\u text
中可能有一段代码触发了思考。很抱歉,在您的情况下,我还需要script\u text
内容。您好,JoDev,我已经输入了上面的代码。顺便说一句,我真的需要改成$.ajax({})?因为除此之外,我还有很多其他页面使用相同的.load()=xHi Dean,谢谢您的帮助,但我已经尝试过了,没有用。您是否尝试过使用Fiddler查看服务器传递和返回的内容?很抱歉,请问什么是Fiddler?因为当我尝试该代码时,它会返回整个html页面,而不仅仅是#ir#u inner#content div中的内容。Fiddler是一个调试工具,它记录所有HTTP和可选HTTPS流量。我明白了。我没用那个=乔德夫:和小提琴手一样?如果是一样的话,也许我可以试试,因为我的公司对安装程序很严格=SHi JoDev,我也不知道,因为这不是我做的。但是我已经尝试将其设置为false,它仍然不起作用;评估(脚本和文本);在.load()中,无法加载整个内容。所以,我别无选择,只能把img标签放到onload中。除了在img标签中加载外,还有其他方法吗?关于
,我的内容在哪里?嗨,JoDev,很抱歉反应太晚了。#ir#u内容不在目录范围内。结构为#ir_content>#ir_inner_content>。这回答了你的问题吗?
<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>
$(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);