2011-09-12 5 views
0

私はqtip2を使用していますが、それらはjQuery ajaxを使用しているようです。jQueryのAjaxをFxで404に渡すことができますか?

IE8では問題ありません。私はエラーと完全を得る

私は決してエラーが発生しない。再現する

  1. を第二の結果で2番目にIPCを超えるhttp://plungjan.name/eclatooltip/
  2. 放火犯のネット上のターンや他のHTTPスニッファ
  3. マウスに行く - B65D30/08

結果:

  • IE:メッセージ:返すことはありません、決して私はこのhttps://gist.github.com/82181

    を見てきましたが、私のコードでそれを使用する方法が表示されない

エラーまたは完全なを実行していない:

  • Fxが「何が見つかりませんでした」。


    コード(eclatt.js)を使用し

    ajax: { 
         dataType: 'jsonp', 
         url: url, 
         once: false, 
         complete: function(jqXHR, textStatus) { // works perfectly in IE 
         // alert("complete:"+jqXHR+":"+ textStatus) 
         }, 
         error: function() { // works perfectly in IE8 
         alert('Error') 
         this.set('content.text', "Nothing found"); 
         }, 
         success: function(oData, sTextStatus, oJqXhr) { 
         /* Construct list */ 
    
         ... 
    
         this.set('content.text', sHtml); 
         } 
        }, 
    
  • 答えて

    1

    明らかに問題がJSONP呼び出しがDOMに<スクリプト>タグを付加することによって処理されること、であり、(404のような)ネットワーク関連のエラーがdoesnのハンドラを起動しないでください(少なくとも、IEは実際よりもスマートにしようとしているはずです)。 jQuery.ajaxエラーハンドラの記述から

    引用:

    Note: This handler is not called for cross-domain script and JSONP requests.

    この問題を克服するために、追加のスクリプトのソースは、タグがロードされており、適切な発射されるたびにチェックされている。この1 jquery-jsonpのようにそこにプラグインがありますもしそうでなければコールバック。

    更新

    ここqtip2 https://github.com/Craga89/qTip2/blob/master/src/ajax/ajax.jsのためのAjaxのプラグインのソースがあります。あなたは、おそらくこれにより

    // Error handler 
    function errorHandler(xh, status, error){ api.set('content.text', status + ': ' + error); } 
    // Setup $.ajax option object and process the request 
    $.ajax($.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url, complete: after })); 
    

    を置き換えることができますすることができます

    if (opts.dataType && opts.dataType.toLowerCase() == 'jsonp') { 
        // Error handler 
        function jsonpErrorHandler(xOptions, status) {api.set('content.text', 'error: ' + status);} 
        // Setup using jsonp 
        $.jsonp($.extend({ success: successHandler, error: jsonpErrorHandler, context: api }, opts, { url: url, complete: after })); 
    } else { 
        // Error handler 
        function errorHandler(xh, status, error){ api.set('content.text', status + ': ' + error); } 
        // Setup $.ajax option object and process the request 
        $.ajax($.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url, complete: after })); 
    } 
    

    それはあなたのjqueryの - JSONPプラグインが埋め込まれている提供動作するはずです。

    +0

    ありがとう - あなたが与えたリンクのqtip ajax呼び出しをどのように置き換えることができるか知っていますか? – mplungjan

    +0

    私は自分の答えを更新しました。 – WTK

    +0

    あなたのより完全な解決策を見る前にちょうど$ .jsonpに変更するだけで作業が完了しました。ありがとう! – mplungjan

    関連する問題