久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='iasiI'><style id='iasiI'><dir id='iasiI'><q id='iasiI'></q></dir></style></legend>

      1. <small id='iasiI'></small><noframes id='iasiI'>

      2. <tfoot id='iasiI'></tfoot>
          <bdo id='iasiI'></bdo><ul id='iasiI'></ul>
        <i id='iasiI'><tr id='iasiI'><dt id='iasiI'><q id='iasiI'><span id='iasiI'><b id='iasiI'><form id='iasiI'><ins id='iasiI'></ins><ul id='iasiI'></ul><sub id='iasiI'></sub></form><legend id='iasiI'></legend><bdo id='iasiI'><pre id='iasiI'><center id='iasiI'></center></pre></bdo></b><th id='iasiI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iasiI'><tfoot id='iasiI'></tfoot><dl id='iasiI'><fieldset id='iasiI'></fieldset></dl></div>

        為什么 Mozilla 的這個 XMLHttpRequest 示例在 Firefox

        Why is this XMLHttpRequest sample from Mozilla is not working in Firefox 3?(為什么 Mozilla 的這個 XMLHttpRequest 示例在 Firefox 3 中不起作用?)
          <tbody id='7hhnP'></tbody>
        <i id='7hhnP'><tr id='7hhnP'><dt id='7hhnP'><q id='7hhnP'><span id='7hhnP'><b id='7hhnP'><form id='7hhnP'><ins id='7hhnP'></ins><ul id='7hhnP'></ul><sub id='7hhnP'></sub></form><legend id='7hhnP'></legend><bdo id='7hhnP'><pre id='7hhnP'><center id='7hhnP'></center></pre></bdo></b><th id='7hhnP'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7hhnP'><tfoot id='7hhnP'></tfoot><dl id='7hhnP'><fieldset id='7hhnP'></fieldset></dl></div>
            1. <legend id='7hhnP'><style id='7hhnP'><dir id='7hhnP'><q id='7hhnP'></q></dir></style></legend>

            2. <tfoot id='7hhnP'></tfoot>

                  <bdo id='7hhnP'></bdo><ul id='7hhnP'></ul>

                  <small id='7hhnP'></small><noframes id='7hhnP'>

                • 本文介紹了為什么 Mozilla 的這個 XMLHttpRequest 示例在 Firefox 3 中不起作用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試從 Mozilla 獲取使用 REST Web 服務以在 Firefox 3.0.10 下工作的示例代碼.以下代碼在 Firefox 中不起作用,但在 IE 8 中起作用!

                  I'm trying to get the sample code from Mozilla that consumes a REST web service to work under Firefox 3.0.10. The following code does NOT work in Firefox but does in IE 8!

                  1. 為什么這不起作用?
                  2. IE 8 是否支持 XMLHttpRequest?我見過的大多數例子都使用 ActiveX分配.我應該做什么?XMLHttpRequest 似乎更加標準化.

                  示例:

                  var req = new XMLHttpRequest();
                  req.open('GET', 'http://localhost/myRESTfulService/resource', false);    // throws 'undefined' exception
                  req.send(null);
                  if(req.status == 0)
                    dump(req.responseText);
                  

                  open 語句引發異常,描述為未定義".這很奇怪,因為我分配了 req 對象,在 Firefox 中運行它,并在調用 open 之前檢查以確保它已定義(它說它是對象"類型).

                  The open statement is throwing an exception with the description 'undefined'. This is strange as I allocate the req object, am running it in Firefox, and checked to make sure it is defined before calling open (which it says it is of type 'object').

                  我也嘗試過異步版本,但沒有成功.

                  I've also tried the asynchronous version of this with no luck.

                  編輯 2:以下是我最近的代碼:

                  function createRequestObject() {
                      if( window.XMLHttpRequest ) {
                          return new XMLHttpRequest();
                      }
                      else if( window.ActiveXObject ) {
                          return new ActiveXObject( "Microsoft.XMLHTTP" );
                      }
                  
                      return null;
                  }
                  
                  function handleResponse( req ) {
                      document.writeln( "Handling response..." );   // NEVER GETS CALLED
                      if( req.readyState == 0 ) {
                          document.writeln( "UNITIALIZED" );
                      }
                      else if( req.readyState == 1 ) {
                          document.writeln( "LOADING" );
                      }
                      else if( req.readyState == 2 ) {
                          document.writeln( "LOADED" );
                      }
                      else if( req.readyState == 3 ) {
                          document.writeln( "INTERACTIVE" ); 
                      }
                      else if( req.readyState == 4 ) {
                          document.writeln( "COMPLETE" );
                          if( req.status == 200 ) {
                              document.writeln( "SUCCESS" );
                          }
                      }
                  }
                  
                  document.writeln( "" );
                  var req = createRequestObject();
                  
                  try {
                      document.writeln( "Opening service..." );
                      req.onreadystatechange = function() { handleResponse( req ); };
                      req.open('POST', 'http://localhost/test/test2.txt', true);  // WORKS IN IE8 & NOT FIREFOX
                  
                  
                      document.writeln( "Sending service request..." );
                      req.send('');
                  
                      document.writeln( "Done" );
                  }
                  catch( err ) {
                      document.writeln( "ERROR: " + err.description );
                  }
                  

                  編輯 3: 好的,我在 jQuery 中重新設計了這個.jQuery 在 IE 中運行良好,但從 Firefox 運行時會拋出未定義".我仔細檢查并在 Firefox 中打開了啟用 JavaScript" - 似乎在所有其他網頁中都可以正常工作.下面是jQuery代碼:

                  EDIT 3: Alright, I reworked this in jQuery. jQuery works great in IE but it throws 'Undefined' when running from Firefox. I double checked and 'Enable JavaScript' is turned on in Firefox - seems to work fine in all other web pages. Below is the jQuery code:

                  function handleResponse( resp ) {
                      alert( "Name: " + resp.Name );
                      alert( "URL: " + resp.URL );
                  }
                  
                  $(document).ready( function() {
                      $("a").click( function(event) {
                  
                          try {
                              $.get( "http://localhost/services/ezekielservices/configservice/ezekielservices.svc/test", 
                                     "{}",
                                     function(data) { handleResponse( data ); },
                                     "json" );
                          } 
                          catch( err ) {
                              alert("'$.get' threw an exception: " + err.description);
                          }
                  
                          event.preventDefault();
                      });
                  } );    // End 'ready' check
                  

                  解決方案總結:

                  好的,網絡課101.我的問題確實是跨域的.我正在查看未發布的網站(僅在文件系統上),該網站正在訪問已發布的服務.當我在同一個域下發布我的網站時,它起作用了.

                  Alright, web lesson 101. My problem was indeed cross-domain. I was viewing my site unpublished (just on the file system) which was hitting a published service. When I published my site under the same domain it worked.

                  這也帶來了 IE 和 Firefox 之間的一個重要區別.當IE遇到這種情況時,會提示用戶是否接受跨域調用.Firefox 拋出異常.雖然我可以有一個例外,但更具描述性的例外會有所幫助.

                  Which also brings up an important distinction between IE and Firefox. When IE experiences this scenario, it prompts the user whether or not they accept the cross-domain call. Firefox throws an exception. While I'm fine with an exception, a more descriptive one would have been helpful.

                  感謝所有幫助過我的人.

                  Thanks for all those who helped me.

                  推薦答案

                  除非'http://www.mozilla.org/' 是此請求的來源域,由于同源策略,這將不起作用

                  unless 'http://www.mozilla.org/' is the domain from which this request originates, this wont work because of same origin policy

                  好的,好的狀態是 200,而不是 0.

                  edit: Ok, a good status is 200, not 0.

                  查看 http://dogself.com/telluriumTest/ 并點擊stackoverflow 測試".它使用您的代碼并正常工作.

                  see http://dogself.com/telluriumTest/ and click on "stackoverflow test". its using your code and working.

                  特別是這段代碼:

                  function test(){
                      var req = new XMLHttpRequest();
                      req.open('GET', 'index2.htm', false);    
                      req.send(null);
                      if(req.status == 200)
                      alert("got some stuff back:"+req.responseText);
                  }
                  

                  這篇關于為什么 Mozilla 的這個 XMLHttpRequest 示例在 Firefox 3 中不起作用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                • <tfoot id='1ZKTA'></tfoot>

                  <small id='1ZKTA'></small><noframes id='1ZKTA'>

                    <bdo id='1ZKTA'></bdo><ul id='1ZKTA'></ul>
                        <tbody id='1ZKTA'></tbody>

                            <legend id='1ZKTA'><style id='1ZKTA'><dir id='1ZKTA'><q id='1ZKTA'></q></dir></style></legend>

                            <i id='1ZKTA'><tr id='1ZKTA'><dt id='1ZKTA'><q id='1ZKTA'><span id='1ZKTA'><b id='1ZKTA'><form id='1ZKTA'><ins id='1ZKTA'></ins><ul id='1ZKTA'></ul><sub id='1ZKTA'></sub></form><legend id='1ZKTA'></legend><bdo id='1ZKTA'><pre id='1ZKTA'><center id='1ZKTA'></center></pre></bdo></b><th id='1ZKTA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1ZKTA'><tfoot id='1ZKTA'></tfoot><dl id='1ZKTA'><fieldset id='1ZKTA'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 91成人免费观看 | 日本一卡精品视频免费 | 午夜男人的天堂 | 一区二区国产在线 | 久久tv在线观看 | 在线观看国产三级 | 欧美日韩一区二区在线观看 | 国产欧美在线视频 | 国产成人精品免高潮在线观看 | 亚洲精品久久久蜜桃网站 | 岛国av免费看| 在线免费观看a级片 | 日本午夜网 | 日韩国产精品一区二区三区 | 国产精品日韩欧美一区二区 | 亚洲视频精品 | 精品自拍视频 | 欧美国产视频 | 天天操天天插天天干 | 精品成人一区二区 | 国内精品久久久久久 | 中文字幕免费在线 | 超碰日本 | www.日韩| 国产欧美精品一区二区色综合朱莉 | 99精品99 | 中文字幕一区在线观看视频 | 久久久久久久久久影视 | 色婷婷国产精品 | 亚洲第一av | 午夜视频免费在线观看 | 国内毛片毛片毛片毛片 | 免费网站国产 | 91午夜在线 | 欧美xxxx色视频在线观看免费 | 久久国产精品视频观看 | 欧美久久久久久 | 国产精品一区在线观看 | 国产一区二区不卡 | 国产精品精品视频一区二区三区 | 亚洲播放 |