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

  • <small id='XxqAS'></small><noframes id='XxqAS'>

      <legend id='XxqAS'><style id='XxqAS'><dir id='XxqAS'><q id='XxqAS'></q></dir></style></legend>

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

        • <bdo id='XxqAS'></bdo><ul id='XxqAS'></ul>

        從 responseText 中獲取特定內(nèi)容

        Get specific content off responseText(從 responseText 中獲取特定內(nèi)容)
        1. <tfoot id='nl0Hp'></tfoot>

            • <bdo id='nl0Hp'></bdo><ul id='nl0Hp'></ul>
                <tbody id='nl0Hp'></tbody>

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

                  <small id='nl0Hp'></small><noframes id='nl0Hp'>

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

                  本文介紹了從 responseText 中獲取特定內(nèi)容的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我正在進(jìn)行 ajax 調(diào)用,并從 responseText 獲取內(nèi)容.

                  我通過(guò)使用 alert 確認(rèn),responseText 包含整個(gè)頁(yè)面作為 string.

                  沒(méi)關(guān)系.現(xiàn)在我需要通過(guò)將字符串轉(zhuǎn)換為 DOM 并使用 getElementsByTagNamegetElementsByName 等從字符串中提取特定內(nèi)容...

                  我的問(wèn)題是這些似乎都不起作用.

                  我已經(jīng)閱讀了很多關(guān)于使用 responseXML 而不是 responseText 的參考資料,但這讓我返回了 null.

                  那么,堅(jiān)持responseText,我怎樣才能得到我想要的特定元素呢?

                  例如,如果我的回復(fù)包含以下內(nèi)容:

                  <html><head>....</head><身體>..........<桌子><tr><td>一些文本</td><td>其他文本</td></tr><tr><td>一些文本</td><td>其他文本</td></tr><tr><td>一些文本</td><td>其他文本</td></tr></表>

                  somediv </div></身體></html>

                  如何訪問(wèn)表格的第二行及其值?或 div 等.所以,現(xiàn)在在我的實(shí)際 html 中,我有這樣的東西

                  <html><頭>.....</頭><身體><table><tr><td id="test">Test</td></tr></table></身體></html>

                  我希望在我的實(shí)際 html 的表中解析提取的元素/值..

                  document.getElementById('test').innerHTML = the_extracted_elements_from_responseText

                  解決方案

                  您需要在 html 上使用 DOMParser 并在結(jié)果文檔上使用 DOM 遍歷方法以返回所需的節(jié)點(diǎn).

                   var parser=new DOMParser();var xmlDoc=parser.parseFromString(responseText,"text/xml");var tds = xmlDoc.getElementsByTagName("td");

                  請(qǐng)注意,IE 將需要 new ActiveXObject("Microsoft.XMLDOM");.

                  I am making an ajax call and I get the content from responseText.

                  I confirm by using alert that inside, the responseText contains the entire page as a string.

                  That's fine. Now I need to extract specific contents from the string by converting it to DOM and using getElementsByTagName, getElementsByName etc...

                  My problem is that none of these seems to work.

                  I've read many references on using responseXML instead of responseText but this gives me back null.

                  So, by sticking to responseText, how can i get the specific elements that I want?

                  For instance if my response contains the following:

                  <html>
                  <head>....</head>
                  <body>....
                   .....
                   <table>
                   <tr>
                   <td>sometext</td>
                   <td>someothertext</td>
                   </tr>
                   <tr>
                   <td>sometext</td>
                   <td>someothertext</td>
                   </tr>
                   <tr>
                   <td>sometext</td>
                   <td>someothertext</td>
                   </tr>    
                   </table> 
                   <div> somediv </div>
                   </body>
                   </html>     
                  

                  how can I access the second row of the table and its value? Or the div etc.. so, now in my actual html, i have sth like this

                  <html>
                  <head>.....</head>
                  <body>
                  <table><tr><td id="test">Test</td></tr></table>
                  </body>
                  </html>
                  

                  i want the extracted element/value to be parsed inside the table of my actual html..

                  document.getElementById('test').innerHTML = the_extracted_elements_from_responseText

                  解決方案

                  You need to use a DOMParser on the html and use DOM traversal methods on the resulting document to return the desired node(s).

                    var parser=new DOMParser();
                    var xmlDoc=parser.parseFromString(responseText,"text/xml");
                    var tds = xmlDoc.getElementsByTagName("td");
                  

                  Note that IE would require new ActiveXObject("Microsoft.XMLDOM"); instead.

                  這篇關(guān)于從 responseText 中獲取特定內(nèi)容的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會(huì)等待 ajax 調(diào)用完成)
                  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 無(wú)法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開發(fā)技術(shù)分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請(qǐng)求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)

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

                          <tbody id='yWgUy'></tbody>

                          <small id='yWgUy'></small><noframes id='yWgUy'>

                            <bdo id='yWgUy'></bdo><ul id='yWgUy'></ul>
                            <legend id='yWgUy'><style id='yWgUy'><dir id='yWgUy'><q id='yWgUy'></q></dir></style></legend>

                          • 主站蜘蛛池模板: www.欧美 | 亚洲成av| 国产成人一区二区三区精 | 欧美久久久久久 | 日韩精品一区二区在线观看 | 国产精品久久国产精品 | 一级毛片免费完整视频 | 97精品超碰一区二区三区 | 成人免费激情视频 | 福利国产| 九九九视频 | 激情a | 粉嫩高清一区二区三区 | 人人射人人| 91人人爽 | 国产精品成人一区 | 成人在线视频一区 | 精品久久99 | 成年免费大片黄在线观看岛国 | 国产乱码精品一区二区三区五月婷 | 日韩免费福利视频 | 在线免费观看黄a | 国产剧情久久 | 久久99精品久久久久久国产越南 | 免费看a | 一区二区三区四区在线视频 | 久久久久久国产精品三区 | 亚洲视频免费在线观看 | 欧美一极视频 | 成人在线播放 | 精品国产一二三区 | 久久中文字幕av | 97精品国产一区二区三区 | 天天操网| 九九九久久国产免费 | 国产成人精品一区二区三区四区 | 91久久国产综合久久 | 久久精品国产一区二区电影 | 国产日韩精品视频 | 亚洲视频在线免费观看 | 这里只有精品99re |