IE9 makes ajax call correctly only ofter hitting F12

前端 未结 4 1632
逝去的感伤
逝去的感伤 2020-12-15 06:50

I have this jQuery code in my JSP page (jQuery 1.7.2) :

   function Header() {
      this.add = function ( parentDiv, leftToolbar, rightToolbar ) {
                  


        
相关标签:
4条回答
  • 2020-12-15 06:55

    really it saved my time, IN IE 11, we should put cache:false for get ajax to get resolved this issue

    0 讨论(0)
  • 2020-12-15 06:59

    console.log is undefined outside of developer mode in IE. I like to just make a variables

    var console = {log: function(){}};
    

    for when I'm not debugging.

    0 讨论(0)
  • 2020-12-15 07:00

    All instances of console.log() need to be removed from your script in order for it to work in IE9 without it being in developer mode.

    UPDATE I'm glad this answer has helped a few people. Just thought I'd update this answer with a simple solution I have been using from HTML5 Boilerplate:

    // Avoid `console` errors in browsers that lack a console.
    (function() {
        var method;
        var noop = function () {};
        var methods = [
            'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
            'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
            'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
            'timeStamp', 'trace', 'warn'
        ];
        var length = methods.length;
        var console = (window.console = window.console || {});
    
        while (length--) {
            method = methods[length];
    
            // Only stub undefined methods.
            if (!console[method]) {
                console[method] = noop;
            }
        }
    }());
    

    Place this before your code and it should help you avoid any console errors in browsers that lack a console.

    0 讨论(0)
  • 2020-12-15 07:04

    I had this problem and I had all the console references commented out in the scripts, but it was still failing in IE only (11). I found the solution was to add cache false to my AJAX calls.

    $.ajax({
            **cache: false,**
            type : 'GET',})
    

    All my inputs have the attribute autocomplete="off"

    0 讨论(0)
提交回复
热议问题