2

I am using AJAX and at the same time executing some javascripts/jquery. I am using .load(). Right now I am having issues on IE7, every browser works fine. Somehow IE7 keeps reloading the same content again and again non stop.

I have tried using

$.ajaxSetup({
   cache: false
});

and

<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" />

None is working.

I really have no idea what is going on and can't find any solutions.

Hope you guys can help me out. Thanks in advance.

My AJAX code:

$('#ir_content').load(pageurl + ' #ir_inner_content');

And because the other file was using a manually coded javascript with backend language so I run the script by using onload on 1 of the img tag:

<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>
4

2 回答 2

0

是什么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);
于 2013-03-15T09:47:35.263 回答
0

尝试在 ajax URL 的末尾添加一个随机字符串。这将停止 IE 缓存内容。像这样:

$('#ir_content').load(pageurl + '?r=' + Math.Random() + '#ir_inner_content');

于 2013-03-15T09:15:48.347 回答