package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?ms)<body.*?>.*?<\/body.*?>`)
var str = `
<!DOCTYPE html>
<html itemscope itemtype="http://schema.org/QAPage" class="html__responsive">
<head>
<title>javascript - Find body tag in an ajax HTML response - Stack Overflow</title>
<link rel="shortcut icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico?v=4f32ecc8f43d">
<link rel="apple-touch-icon image_src" href="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png?v=c78bd457575a">
<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0">
<meta property="og:type" content= "website" />
<meta property="og:url" content="https://stackoverflow.com/questions/14423257/find-body-tag-in-an-ajax-html-response"/>
<meta property="og:site_name" content="Stack Overflow" />
<meta property="og:image" itemprop="image primaryImageOfPage" content="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon@2.png?v=73d79a89bded" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:domain" content="stackoverflow.com"/>
<meta name="twitter:title" property="og:title" itemprop="name" content="Find body tag in an ajax HTML response" />
<meta name="twitter:description" property="og:description" itemprop="description" content="I'm making an ajax call to fetch content and append this content like this:
$(function(){
var site = $('input').val();
$.get('file.php', { site:site }, function(data){
mas = $(data..." />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.sstatic.net/Js/stub.en.js?v=d8c44be5b766"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Shared/stacks.css?v=04c46e63fdc0" >
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/stackoverflow/primary.css?v=3121fd52eed8" >
<link rel="alternate" type="application/atom+xml" title="Feed for question 'Find body tag in an ajax HTML response'" href="/feeds/question/14423257">
<meta name="twitter:app:country" content="US" />
<meta name="twitter:app:name:iphone" content="Stack Exchange iOS" />
<meta name="twitter:app:id:iphone" content="871299723" />
<meta name="twitter:app:url:iphone" content="se-zaphod://stackoverflow.com/questions/14423257/find-body-tag-in-an-ajax-html-response" />
<meta name="twitter:app:name:ipad" content="Stack Exchange iOS" />
<meta name="twitter:app:id:ipad" content="871299723" />
<meta name="twitter:app:url:ipad" content="se-zaphod://stackoverflow.com/questions/14423257/find-body-tag-in-an-ajax-html-response" />
<meta name="twitter:app:name:googleplay" content="Stack Exchange Android">
<meta name="twitter:app:url:googleplay" content="http://stackoverflow.com/questions/14423257/find-body-tag-in-an-ajax-html-response">
<meta name="twitter:app:id:googleplay" content="com.stackexchange.marvin">
<script>
StackExchange.ready(function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.initSnippetRenderer();
});
StackExchange.using("postValidation", function () {
StackExchange.postValidation.initOnBlurAndSubmit($('#post-form'), 2, 'answer');
});
StackExchange.question.init({canOpenBounty:true,votesCast:[{"PostId":35157782,"VoteTypeId":2}],totalCommentCount:7,shownCommentCount:5,highlightColor:'#F4A83D',backgroundColor:'#FFF',questionId:14423257});
styleCode();
StackExchange.realtime.subscribeToQuestion('1', '14423257');
StackExchange.using("gps", function () { StackExchange.gps.trackOutboundClicks('#content', '.post-text'); });
});
</script>
<script>
StackExchange.ready(function () {
StackExchange.realtime.init('wss://qa.sockets.stackexchange.com');
StackExchange.realtime.subscribeToReputationNotifications('1');
StackExchange.realtime.subscribeToTopBarNotifications('1');
});
</script>
<script>
StackExchange.init({"locale":"en","serverTime":1565524525,"routeName":"Questions/Show","stackAuthUrl":"https://stackauth.com","networkMetaHostname":"meta.stackexchange.com","site":{"name":"Stack Overflow","description":"Q&A for professional and enthusiast programmers","isNoticesTabEnabled":true,"enableNewTagCreationWarning":true,"insertSpaceAfterNameTabCompletion":false,"id":1,"childUrl":"https://meta.stackoverflow.com","enableSocialMediaInSharePopup":true,"protocol":"https"},"user":{"fkey":"f6f2ebf21d8ca3adecc9721936e5c65c30c2ee0846c13d2366d2f91f21dff267","tid":"a3583497-d888-975d-8420-b9f6bddb169a","rep":343,"isRegistered":true,"userType":3,"userId":4563136,"accountId":5783062,"gravatar":"<div class=\"gravatar-wrapper-32\"><img src=\"https://graph.facebook.com/10202498284137044/picture?type=large\" alt=\"\" width=\"32\" height=\"32\"></div>","profileUrl":"https://stackoverflow.com/users/4563136/noel-schenk","canSeeDeletedPosts":false,"ab":{"hero_signup_button":{"v":"team_tofu_create_cta_c","g":2}}},"realtime":{"newest":false,"active":false,"tagged":true,"staleDisconnectIntervalInHours":0},"events":{"postType":{"question":1},"postEditionSection":{"title":1,"body":2,"tags":3}},"story":{"minCompleteBodyLength":75,"likedTagsMaxLength":300,"dislikedTagsMaxLength":300},"jobPreferences":{"maxNumDeveloperRoles":2,"maxNumIndustries":4},"svgIconPath":"https://cdn.sstatic.net/Img/svg-icons","svgIconHash":"c0fe2eea72c0"}, {"userProfile":{"openGraphAPIKey":"4a307e43-b625-49bb-af15-ffadf2bda017"},"userMessaging":{},"tags":{},"snippets":{"snippetsEnabled":true,"renderDomain":"stacksnippets.net"},"slack":{"sidebarAdDismissCookie":"slack-sidebar-ad"},"site":{"allowImageUploads":true,"enableUserHovercards":true,"styleCode":true,"enableImgurHttps":true,"forceHttpsImages":true},"paths":{},"monitoring":{"clientTimingsAbsoluteTimeout":30000,"clientTimingsDebounceTimeout":1000},"mentions":{"maxNumUsersInDropdown":50},"markdown":{"asteriskIntraWordEmphasis":true},"flags":{"allowRetractingFlags":true},"comments":{},"accounts":{"currentPasswordRequiredForChangingStackIdPassword":true}});
StackExchange.using.setCacheBreakers({"js/prettify-full.en.js":"49d200e7d768","js/moderator.en.js":"cf6267a57e19","js/pseudomoderator.en.js":"e14f83f0e71d","js/full-anon.en.js":"7ddf2db08695","js/full.en.js":"f5fb6c1b2b57","js/wmd.en.js":"6bb11c906103","js/mobile.en.js":"315fdaca0777","js/help.en.js":"c4c00c65801f","js/tageditor.en.js":"7df384c25d48","js/tageditornew.en.js":"b76030594e82","js/inline-tag-editing.en.js":"ef399cca63df","js/revisions.en.js":"9042f0dc9de0","js/review.en.js":"e111d6cf8714","js/tagsuggestions.en.js":"6bbb2fcbc47c","js/post-validation.en.js":"36b21edb94af","js/explore-qlist.en.js":"5c7424c271ef","js/events.en.js":"85be818d3cc8","js/keyboard-shortcuts.en.js":"4a76a7a6f368","js/adops.en.js":"22a9bd59b1e9","js/begin-edit-event.en.js":"3238dd301e69","js/stacks-polyfills.en.js":"cd6fd603e3e0","js/snippet-javascript-codemirror.en.js":"a045fdf8e571"});
StackExchange.using("gps", function() {
StackExchange.gps.init(true);
});
</script>
<noscript id="noscript-css"><style>body,.top-bar{margin-top:1.9em}</style></noscript>
</head>
<body class="question-page unified-theme">
<div id="notify-container"></div>
<div id="custom-header"></div>
<header class="top-bar js-top-bar top-bar__network _fixed">
<div class="-container" role="menubar">
<div class="-main">
<a href="#" class="left-sidebar-toggle p0 ai-center jc-center js-left-sidebar-toggle" role="menuitem" aria-haspopup="true" aria-controls="left-sidebar" aria-expanded="false"><span class="ps-relative"></span></a>
<div class="topbar-dialog leftnav-dialog js-leftnav-dialog dno">
<div class="left-sidebar js-unpinned-left-sidebar" data-can-be="left-sidebar" data-is-here-when="sm"></div>
</div>
<a href="https://stackoverflow.com" class="-logo js-gps-track"
data-gps-track="top_nav.click({is_current:false, location:2, destination:8})">
<span class="-img _glyph">Stack Overflow</span>
</a>
</div>
<ol class="list-reset grid gs4" role="presentation">
<li class="grid--cell">
<a href="#"
class="-marketing-link js-gps-track js-products-menu"
aria-controls="products-popover"
data-controller="s-popover"
data-action="s-popover#toggle"
data-s-popover-placement="bottom"
data-gps-track="top_nav.products.click({location:2, destination:1})"
data-ga="["top navigation","products menu click",null,null,null]">
Products
</a>
</li>
</ol>
<div class="s-popover ws2 p6"
id="products-popover"
role="menu"
aria-hidden="true">
<div class="s-popover--arrow"></div>
<ol class="list-reset s-anchors s-anchors__inherit">
<li>
<a href="/" class="d-block py6 px6 bar-sm h:bg-orange-500 h:fc-white js-gps-track"
data-gps-track="top_nav.products.click({location:2, destination:2})"
data-ga="["top navigation","public qa submenu click",null,null,null]">
<span class="fs-body1 d-block">Stack Overflow</span>
<span class="fs-caption d-block o70">Public questions and answers</span>
</a>
</li>
<li>
<a href="/teams" class="d-block py6 px6 bar-sm h:bg-orange-500 h:fc-white js-gps-track"
data-gps-track="top_nav.products.click({location:2, destination:3})"
data-ga="["top navigation","teams submenu click",null,null,null]">
<span class="fs-body1 d-block">Teams</span>
<span class="fs-caption d-block o70">Private questions and answers for your team</span>
</a>
</li>
<li>
<a href="/enterprise" class="d-block py6 px6 bar-sm h:bg-orange-500 h:fc-white js-gps-track"
data-gps-track="top_nav.products.click({location:2, destination:4})"
data-ga="["top navigation","enterprise submenu click",null,null,null]">
<span class="fs-body1 d-block">Enterprise</span>
<span class="fs-caption d-block o70">Private self-hosted questions and answers for your enterprise</span>
</a>
</li>
<li class="bt bc-black-3 mln6 mrn6 mt6 pt6 px6">
<a href="https://www.stackoverflowbusiness.com/talent" class="d-block py6 px6 bar-sm h:bg-orange-500 h:fc-white js-gps-track"
data-gps-track="top_nav.products.click({location:2, destination:5})"
data-ga="["top navigation","talent submenu click",null,null,null]">
<span class="fs-body1 d-block">Talent</span>
<span class="fs-caption d-block o70">Hire technical talent</span>
</a>
</li>
<li>
<a href="https://www.stackoverflowbusiness.com/advertising" class="d-block py6 px6 bar-sm h:bg-orange-500 h:fc-white js-gps-track"
data-gps-track="top_nav.products.click({location:2, destination:6})"
data-ga="["top navigation","advertising submenu click",null,null,null]">
<span class="fs-body1 d-block">Advertising</span>
<span class="fs-caption d-block o70">Reach developers worldwide</span>
</a>
</li>
<li class="bt bc-black-3 mln6 mrn6 mt6 pt6 px6">
<a href="/teams/customers" class="fc-light d-block py6 px6 h:fc-orange-500 js-gps-track"
data-gps-track="top_nav.products.click({location:2, destination:7})"
data-ga="["top navigation","customers submenu click",null,null,null]">Customers</a>
</li>
<li class="">
<a href="/teams/use-cases" class="fc-light d-block py6 px6 h:fc-orange-500 js-gps-track"
data-gps-track="top_nav.products.click({location:2, destination:8})"
data-ga="["top navigation","use cases submenu click",null,null,null]">Use cases</a>
</li>
</ol>
</div>
<form id="search" action=/search method="get" class="searchbar js-searchbar " autocomplete="off">
<div class="ps-relative">
<input name="q"
type="text"
placeholder="Search…"
value=""
autocomplete="off"
maxlength="240"
class="s-input s-input__search js-search-field "
aria-label="Search" />
<svg aria-hidden="true" class="svg-icon s-input-icon s-input-icon__search iconSearch" width="18" height="18" viewBox="0 0 18 18"><path d="M18 16.5l-5.14-5.18h-.35a7 7 0 1 0-1.19 1.19v.35L16.5 18l1.5-1.5zM12 7A5 5 0 1 1 2 7a5 5 0 0 1 10 0z"/></svg>
</div>
</form>
<ol class="-secondary js-secondary-topbar-links drop-icons-responsively user-logged-in" role="presentation">
<li class="-item searchbar-trigger js-searchbar-trigger"><a href="#" class="-link" role="button" aria-label="Search" aria-haspopup="true" aria-controls="search" title="Click to show search"><svg aria-hidden="true" class="svg-icon iconSearch" width="18" height="18" viewBox="0 0 18 18"><path d="M18 16.5l-5.14-5.18h-.35a7 7 0 1 0-1.19 1.19v.35L16.5 18l1.5-1.5zM12 7A5 5 0 1 1 2 7a5 5 0 0 1 10 0z"/></svg></a></li>
<li class="-item">
<a href="/users/4563136/noel-schenk" class="my-profile js-gps-track" data-gps-track="profile_summary.click()">
<div class="gravatar-wrapper-24" title="Noel Schenk"><img src="https://graph.facebook.com/10202498284137044/picture?type=large" alt="" width="24" height="24" class="-avatar js-avatar-me"></div> <span class="v-visible-sr">Noel Schenk</span>
<div class="-rep js-header-rep" title="your reputation: 343" aria-hidden="true">343</div>
<span class="v-visible-sr">, 343 reputation</span>
<div class="-badges">
<span title="2 silver badges" aria-hidden="true"><span class="badge2">●</span><span class="badgecount">2</span></span><span class="v-visible-sr">2 silver badges</span><span title="14 bronze badges" aria-hidden="true"><span class="badge3">●</span><span class="badgecount">14</span></span><span class="v-visible-sr">14 bronze badges</span> </div>
</a>
</li>
<li class="-item inbox-button-item" >
<a href="https://stackexchange.com/users/5783062?tab=inbox" class="-link js-inbox-button"
aria-label="Inbox" title="Recent inbox messages" role="menuitem" aria-haspopup="true" aria-expanded="false" data-unread-count="0">
<svg aria-hidden="true" class="svg-icon iconInbox" width="20" height="18" viewBox="0 0 20 18"><path d="M4.63 1h10.56a2 2 0 0 1 1.94 1.35L20 10.79V15a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-4.21l2.78-8.44c.25-.8 1-1.36 1.85-1.35zm8.28 12l2-2h2.95l-2.44-7.32a1 1 0 0 0-.95-.68H5.35a1 1 0 0 0-.95.68L1.96 11h2.95l2 2h6z"/></svg>
<span class="indicator-badge js-unread-count _important d-none">0</span>
</a>
</li>
<li class="-item achievements-button-item" >
<a href="https://stackexchange.com/users/5783062?tab=reputation" class="-link js-achievements-button" data-unread-class="_highlighted-positive"
aria-label="Achievements" title="Recent achievements: reputation, badges, and privileges earned" role="menuitem" aria-haspopup="true" aria-expanded="false" data-unread-count="0" data-lit-up="false">
<svg aria-hidden="true" class="svg-icon iconAchievements" width="18" height="18" viewBox="0 0 18 18"><path d="M15 2V1H3v1H0v4c0 1.6 1.4 3 3 3v1c.4 1.5 3 2.6 5 3v2H5s-1 1.5-1 2h10c0-.4-1-2-1-2h-3v-2c2-.4 4.6-1.5 5-3V9c1.6-.2 3-1.4 3-3V2h-3zM3 7c-.5 0-1-.5-1-1V4h1v3zm8.4 2.5L9 8 6.6 9.4l1-2.7L5 5h3l1-2.7L10 5h2.8l-2.3 1.8 1 2.7h-.1zM16 6c0 .5-.5 1-1 1V4h1v2z"/></svg>
<span class="indicator-badge js-unread-count _positive d-none">+0</span>
</a>
</li>
<li class="-item help-button-item" data-remove-order=1>
<a href="#" class="-link js-help-button" title="Help Center and other resources" role="menuitem" aria-haspopup="true" aria-controls="topbar-help-dialog"
data-ga="["top navigation","help menu click",null,null,null]"><svg aria-hidden="true" class="svg-icon iconHelp" width="18" height="18" viewBox="0 0 18 18"><path d="M9 1a8 8 0 1 0 0 16A8 8 0 0 0 9 1zm.81 12.13c-.02.71-.55 1.15-1.24 1.13-.66-.02-1.17-.49-1.15-1.2.02-.72.56-1.18 1.22-1.16.7.03 1.2.51 1.17 1.23zM11.77 8c-.3.34-.65.65-1.02.91l-.53.37c-.26.2-.42.43-.5.69a4 4 0 0 0-.09.75c0 .05-.03.16-.18.16H7.88c-.16 0-.18-.1-.18-.15.03-.66.12-1.21.4-1.66.4-.49.88-.9 1.43-1.22.16-.12.28-.25.38-.39a1.34 1.34 0 0 0 .02-1.71c-.24-.31-.51-.46-1.03-.46-.51 0-.8.26-1.02.6-.21.33-.18.73-.18 1.1H5.75c0-1.38.35-2.25 1.1-2.76.52-.35 1.17-.5 1.93-.5 1 0 1.79.18 2.49.71.64.5.98 1.18.98 2.12 0 .57-.2 1.05-.48 1.44z"/></svg></a>
</li>
<div class="topbar-dialog help-dialog js-help-dialog dno" id="topbar-help-dialog" role="menu">
<div class="modal-content">
<ul>
<li>
<a href="/tour" class="js-gps-track" data-gps-track="help_popup.click({ item_type:1 })"
data-ga="["top navigation","tour submenu click",null,null,null]">
Tour
<span class="item-summary">
Start here for a quick overview of the site
</span>
</a>
</li>
<li>
<a href="/help" class="js-gps-track"
data-gps-track="help_popup.click({ item_type:4 })"
data-ga="["top navigation","help center",null,null,null]">
Help Center
<span class="item-summary">
Detailed answers to any questions you might have
</span>
</a>
</li>
<li>
<a href="https://meta.stackoverflow.com" class="js-gps-track" data-gps-track="help_popup.click({ item_type:2 })"
data-ga="["top navigation","meta submenu click",null,null,null]">
Meta
<span class="item-summary">
Discuss the workings and policies of this site
</span>
</a>
</li>
<li>
<a href="https://stackoverflow.com/company/about" class="js-gps-track" data-gps-track="help_popup.click({ item_type:6 })"
data-ga="["top navigation","about us submenu click",null,null,null]">
About Us
<span class="item-summary">
Learn more about Stack Overflow the company
</span>
</a>
</li>
<li>
<a href="https://www.stackoverflowbusiness.com/?ref=topbar_help" class="js-gps-track" data-gps-track="help_popup.click({ item_type:7 })"
data-ga="["top navigation","business submenu click",null,null,null]">
Business
<span class="item-summary">
Learn more about hiring developers or posting ads with us
</span>
</a>
</li>
</ul>
</div>
</div>
<li class="-item site-switcher-item">
<a href="https://stackexchange.com" class="-link js-site-switcher-button js-gps-track" data-gps-track="site_switcher.show"
aria-label="Site switcher"
title="A list of all 175 Stack Exchange sites"
role="menuitem" aria-haspopup="true" aria-expanded="false"
data-ga="["top navigation","stack exchange click",null,null,null]">
<svg aria-hidden="true" class="svg-icon iconStackExchange" width="18" height="18" viewBox="0 0 18 18"><path d="M15 1H3a2 2 0 0 0-2 2v2h16V3a2 2 0 0 0-2-2zM1 13c0 1.1.9 2 2 2h8v3l3-3h1a2 2 0 0 0 2-2v-2H1v2zm16-7H1v4h16V6z"/></svg>
</a>
</li>
<li class="js-topbar-dialog-corral" role="presentation">
<div class="topbar-dialog siteSwitcher-dialog dno" role="menu">
<div class="header">
<h3><a href="https://stackoverflow.com">current community</a>
</h3>
</div>
<div class="modal-content current-site-container">
<ul class="current-site">
<li class="grid">
<div class="fl1">
<a href="https://stackoverflow.com"
class="current-site-link site-link js-gps-track grid gs8 gsx"
data-id="1"
data-gps-track="site_switcher.click({ item_type:3 })">
<div class="favicon favicon-stackoverflow site-icon grid--cell" title="Stack Overflow"></div>
<span class="grid--cell fl1">
Stack Overflow
</span>
</a>
</div>
<div class="related-links">
<a href="https://stackoverflow.com/help" class="js-gps-track" data-gps-track="site_switcher.click({ item_type:14 })"
>help</a>
<a href="https://chat.stackoverflow.com" class="js-gps-track" data-gps-track="site_switcher.click({ item_type:6 })"
>chat</a>
<a href="https://stackoverflow.com/users/logout" class="js-gps-track" data-gps-track="site_switcher.click({ item_type:8 })"
>log out</a>
</div>
</li>
<li class="related-site grid">
<div class="L-shaped-icon-container">
<span class="L-shaped-icon"></span>
</div>
<a href="https://meta.stackoverflow.com"
class="site-link js-gps-track grid gs8 gsx"
data-id="552"
data-gps-track="site.switch({ target_site:552, item_type:3 }),site_switcher.click({ item_type:4 })">
<div class="favicon favicon-stackoverflowmeta site-icon grid--cell" title="Meta Stack Overflow"></div>
<span class="grid--cell fl1">
Meta Stack Overflow
</span>
</a>
</li>
</ul>
</div>
<div class="header" id="your-communities-header">
<h3>
<a href="https://stackexchange.com/users/5783062/?tab=accounts">your communities</a>
</h3>
<a href="#" id="edit-pinned-sites">edit</a>
<a href="#" id="cancel-pinned-sites" style="display: none;">cancel</a>
</div>
<div class="modal-content" id="your-communities-section">
<ul class="my-sites">
<li>
<a href="https://stackoverflow.com"
class="site-link js-gps-track grid gs8 gsx"
data-id="1"
data-gps-track="site.switch({ target_site:1, item_type:3 }),site_switcher.click({ item_type:1 })">
<div class="favicon favicon-stackoverflow site-icon grid--cell" title="Stack Overflow"></div>
<span class="grid--cell fl1">
Stack Overflow
</span>
<span class="rep-score grid--cell">343</span>
</a>
</li>
<li>
<a href="https://security.stackexchange.com"
class="site-link js-gps-track grid gs8 gsx"
data-id="162"
data-gps-track="site.switch({ target_site:162, item_type:3 }),site_switcher.click({ item_type:1 })">
<div class="favicon favicon-security site-icon grid--cell" title="Information Security"></div>
<span class="grid--cell fl1">
Information Security
</span>
<span class="rep-score grid--cell">103</span>
</a>
</li>
<li>
<a href="https://magento.stackexchange.com"
class="site-link js-gps-track grid gs8 gsx"
data-id="479"
data-gps-track="site.switch({ target_site:479, item_type:3 }),site_switcher.click({ item_type:1 })">
<div class="favicon favicon-magento site-icon grid--cell" title="Magento"></div>
<span class="grid--cell fl1">
Magento
</span>
<span class="rep-score grid--cell">103</span>
</a>
</li>
<li>
<a href="https://serverfault.com"
class="site-link js-gps-track grid gs8 gsx"
data-id="2"
data-gps-track="site.switch({ target_site:2, item_type:3 }),site_switcher.click({ item_type:1 })">
<div class="favicon favicon-serverfault site-icon grid--cell" title="Server Fault"></div>
<span class="grid--cell fl1">
Server Fault
</span>
<span class="rep-score grid--cell">101</span>
</a>
</li>
<li>
<a href="https://superuser.com"
class="site-link js-gps-track grid gs8 gsx"
data-id="3"
data-gps-track="site.switch({ target_site:3, item_type:3 }),site_switcher.click({ item_type:1 })">
<div class="favicon favicon-superuser site-icon grid--cell" title="Super User"></div>
<span class="grid--cell fl1">
Super User
</span>
<span class="rep-score grid--cell">101</span>
</a>
</li>
</ul>
<div class="pinned-site-editor-container" style="display: none;">
<input type="hidden" name="fkey" value="f6f2ebf21d8ca3adecc9721936e5c65c30c2ee0846c13d2366d2f91f21dff267">
<input id="js-site-search-txt"
type="text"
class="site-filter-input"
value=""
placeholder="Add a Stack Exchange community"/>
<input type="submit" id="pin-site-btn" value="Add" disabled="disabled"/>
<ul class="js-found-sites found-sites"></ul>
<ul class="pinned-site-list sortable" data-custom-list="False">
</ul>
<input type="submit" value="Save" id="save-pinned-sites-btn" disabled="disabled"/>
<a href="#" id="reset-pinned-sites">reset to default list</a>
</div>
</div>
<div class="header">
<h3><a href="https://stackexchange.com/sites">more stack exchange communities</a>
</h3>
<a href="https://stackoverflow.blog" class="fr">company blog</a>
</div>
<div class="modal-content">
<div class="child-content"></div>
</div>
</div>
</li>
</ol>
</div>
</header>
<script>
StackExchange.ready(function () { StackExchange.topbar.init({ observeSize: true }); });
StackExchange.scrollPadding.setPaddingTop(50, 10); </script>
<div class="container">
<div id="left-sidebar" data-is-here-when="md lg" class="left-sidebar js-pinned-left-sidebar">
<div class="left-sidebar--sticky-container js-sticky-leftnav">
<nav role="navigation">
<ol class="nav-links">
<li>
<a
href="/"
class="pl8 js-gps-track nav-links--link"
data-gps-track="top_nav.click({is_current:false, location:2, destination:8})">
Home </a>
</li>
<li>
<ol class="nav-links">
<li class="fs-fine tt-uppercase ml8 mt16 mb4 fc-light">Public</li>
<li class=" youarehere">
<a id="nav-questions"
href="/questions"
class="pl8 js-gps-track nav-links--link -link__with-icon"
data-gps-track="top_nav.click({is_current:true, location:2, destination:1})">
<svg aria-hidden="true" class="svg-icon iconGlobe" width="18" height="18" viewBox="0 0 18 18"><path d="M9 1a8 8 0 1 0 0 16A8 8 0 0 0 9 1zM8 15.32a6.4 6.4 0 0 1-5.23-7.75L7 11.68v.8c0 .88.12 1.32 1 1.32v1.52zm5.72-2c-.2-.66-1-1.32-1.72-1.32h-1v-2c0-.44-.56-1-1-1H6V7h1c.44 0 1-.56 1-1V5h2c.88 0 1.4-.72 1.4-1.6v-.33a6.4 6.4 0 0 1 2.32 10.24v.01z"/></svg> <span class="-link--channel-name">Stack Overflow</span>
</a>
</li>
<li>
<a id="nav-tags"
href="/tags"
class=" js-gps-track nav-links--link"
data-gps-track="top_nav.click({is_current:false, location:2, destination:2})">
Tags </a>
</li>
<li>
<a id="nav-users"
href="/users"
class=" js-gps-track nav-links--link"
data-gps-track="top_nav.click({is_current:false, location:2, destination:3})">
Users </a>
</li>
<li>
<a id="nav-jobs"
href="/jobs?med=site-ui&ref=jobs-tab"
class=" js-gps-track nav-links--link"
data-gps-track="top_nav.click({is_current:false, location:2, destination:6})">
Jobs </a>
</li>
</ol>
</li>
<li>
<ol class="nav-links">
<li class="grid ai-center jc-space-between ml8 mt24 mb4">
<div class="grid--cell tt-uppercase fs-fine fc-light">Teams</div>
<div class="grid--cell fs-fine fc-light mr4">
<a href="javascript:void(0)" class="s-link s-link__inherit js-gps-track"
role="button"
aria-controls="popover-teams-create-cta"
data-controller="s-popover"
data-action="s-popover#toggle"
data-s-popover-placement="bottom-start"
data-s-popover-toggle-class="is-selected"
data-gps-track="teams.create.left-sidenav.click({ Action: ShowInfo })"
data-ga="["teams left navigation","left nav show teams info",null,null,null]">
What’s this?
</a>
<div class="s-popover w-auto p16"
id="popover-teams-create-cta"
role="menu"
aria-hidden="true">
<div class="s-popover--arrow"></div>
<div class="ps-relative overflow-hidden">
<p class="mb2"><strong>Teams</strong></p>
<p class="mb16 fs-caption fc-medium">Q&A for Work</p>
<p class="mb8 fs-caption fc-medium">
Setup a private space for you and your coworkers to ask questions and share information.
</p>
<a href="https://stackoverflow.com/teams"
class="js-gps-track ws-nowrap d-block"
data-gps-track="teams.create.left-sidenav.click({ Action: CtaClick })"
data-ga="["teams left navigation","left nav cta","stackoverflow.com/teams",null,null]">
Learn more about Teams
</a>
</div>
<div class="ps-absolute t8 r8">
<svg width="53" height="49" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M49 11l.2 31H18.9L9 49v-7H4V8h31" fill="#CCEAFF" /><path d="M44.5 19v-.3l-.2-.1-18-13-.1-.1H.5v33h4V46l.8-.6 9.9-6.9h29.3V19z" stroke="#1060E1" stroke-miterlimit="10" /><path d="M31 2l6-1.5 7 2V38H14.9L5 45v-7H1V6h25l5-4z" fill="#fff" /><path d="M7 16.5h13m-13 6h14m-14 6h18" stroke="#1060E1" stroke-miterlimit="10" /><path d="M39 30a14 14 0 1 0 0-28 14 14 0 0 0 0 28z" fill="#FFB935" /><path d="M50.5 14a13.5 13.5 0 1 1-27 0 13.5 13.5 0 0 1 27 0z" stroke="#F48024" stroke-miterlimit="10" /><path d="M32.5 21.5v-8h9v8h-9zm2-9.5V9.3A2.5 2.5 0 0 1 37 6.8a2.5 2.5 0 0 1 2.5 2.5V12h-5zm2 3v2m1-2v2" stroke="#fff" stroke-miterlimit="10" /></svg>
</div>
</div>
</div>
</li>
<li class="ps-relative">
<a href="https://stackoverflow.com/teams"
class="pl8 js-gps-track nav-links--link fc-blue-600"
title="A private, secure home for your team's questions and answers. Starts at $10/month"
data-gps-track="teams.create.left-sidenav.click({ Action: TeamsClick })"
data-ga="["teams left navigation","left nav team click","stackoverflow.com/teams",null,null]">
<div class="grid ai-center">
<div class="grid--cell s-avatar va-middle bg-blue-400">
<div class="s-avatar--letter mtn1">
<svg aria-hidden="true" class="svg-icon iconBriefcaseSm" width="14" height="14" viewBox="0 0 14 14"><path d="M4 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1h1a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h1V3zm5 0H5v1h4V3z"/></svg>
</div>
<svg aria-hidden="true" class="svg-icon native s-avatar--badge iconShieldXSm" width="9" height="10" viewBox="0 0 9 10"><path d="M0 1.84L4.5 0 9 1.84v3.17C9 7.53 6.3 10 4.5 10 2.7 10 0 7.53 0 5.01V1.84z" fill="#fff"/><path d="M1 2.5L4.5 1 8 2.5v2.51C8 7.34 5.34 9 4.5 9 3.65 9 1 7.34 1 5.01V2.5zm2.98 3.02L3.2 7h2.6l-.78-1.48a.4.4 0 0 1 .15-.38c.34-.24.73-.7.73-1.14 0-.71-.5-1.23-1.41-1.23-.92 0-1.39.52-1.39 1.23 0 .44.4.9.73 1.14.12.08.18.23.15.38z" fill="#6A7E7C"/></svg>
</div>
<div class="grid--cell pl6 js-create-team-btn-with-tooltip">
Q&A for Work
</div>
</div>
</a>
</li>
</ol>
</li>
</ol>
</nav>
</div>
</div>
<div id="content" class="snippet-hidden">
<div itemprop="mainEntity" itemscope itemtype="http://schema.org/Question">
<link itemprop="image" href="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png?v=c78bd457575a">
<div class="inner-content clearfix">
<div id="question-header" class="grid">
<h1 itemprop="name" class="grid--cell fs-headline1 fl1 ow-break-word mb8"><a href="/questions/14423257/find-body-tag-in-an-ajax-html-response" class="question-hyperlink">Find body tag in an ajax HTML response</a></h1>
<div class="pl8 aside-cta grid--cell print:d-none">
<a href="/questions/ask" class="ws-nowrap s-btn s-btn__primary" >
Ask Question
</a>
</div>
</div>
<div class="grid fw-wrap pb8 mb16 bb bc-black-2">
<div class="grid--cell ws-nowrap mr16 mb8" title="2013-01-20 09:34:22Z">
<span class="fc-light mr2">Asked</span>
<time itemprop="dateCreated" datetime="2013-01-20T09:34:22">6 years, 6 months ago</time>
</div>
<div class="grid--cell ws-nowrap mr16 mb8">
<span class="fc-light mr2">Active</span>
<a href="?lastactivity" class="s-link s-link__inherit" title="2016-07-06 15:23:41Z">3 years, 1 month ago</a>
</div>
<div class="grid--cell ws-nowrap mb8" title="Viewed 21,753 times">
<span class="fc-light mr2">Viewed</span>
22k times
</div>
</div>
<div id="mainbar" role="main" aria-label="question and answers">
<div class="question" data-questionid="14423257" id="question">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid fd-column ai-stretch gs4 fc-black-200" data-post-id="14423257">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer" title="This question shows research effort; it is useful and clear (click again to undo)" aria-pressed="false" aria-label="up vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowUpLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center" itemprop="upvoteCount" data-value="20">20</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" title="This question does not show any research effort; it is unclear or not useful (click again to undo)" aria-pressed="false" aria-label="down vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowDownLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2 10z"/></svg></button>
<button class="js-favorite-btn s-btn s-btn__unset c-pointer py8" aria-pressed="false" aria-label="favorite (6)" data-selected-classes="fc-yellow-600">
<svg aria-hidden="true" class="svg-icon iconStar" width="18" height="18" viewBox="0 0 18 18"><path d="M9 12.65l-5.29 3.63 1.82-6.15L.44 6.22l6.42-.17L9 0l2.14 6.05 6.42.17-5.1 3.9 1.83 6.16L9 12.65z"/></svg>
<div class="js-favorite-count mt8" data-value="6">6</div>
</button>
</div>
</div>
<div class="postcell post-layout--right">
<div class="post-text" itemprop="text">
<p>I'm making an ajax call to fetch content and append this content like this:</p>
<pre><code>$(function(){
var site = $('input').val();
$.get('file.php', { site:site }, function(data){
mas = $(data).find('a');
mas.map(function(elem, index) {
divs = $(this).html();
$('#result').append('' + divs + '');
})
}, 'html');
});
</code></pre>
<p>The problem is that when I change <code>a</code> in <code>body</code> I get nothing (no error, just no html). Im assuming body is a tag just like 'a' is? What am I doing wrong?</p>
<p>So this works for me:</p>
<pre><code> mas = $(data).find('a');
</code></pre>
<p>But this doesn't:</p>
<pre><code> mas = $(data).find('body');
</code></pre>
</div>
<div class="post-taglist grid gs4 gsy fd-column">
<div class="grid ps-relative d-block">
<a href="/questions/tagged/javascript" class="post-tag" title="show questions tagged 'javascript'" rel="tag">javascript</a> <a href="/questions/tagged/jquery" class="post-tag" title="show questions tagged 'jquery'" rel="tag">jquery</a> <a href="/questions/tagged/ajax" class="post-tag" title="show questions tagged 'ajax'" rel="tag">ajax</a> <a href="/questions/tagged/document-body" class="post-tag" title="show questions tagged 'document-body'" rel="tag">document-body</a>
</div>
</div>
<div class="mb0 ">
<div class="mt16 pt4 grid gs8 gsy fw-wrap jc-end ai-start">
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu"><a href="/q/14423257/4563136" title="short permalink to this question" class="short-link" itemprop="url" id="link-post-14423257">share</a><span class="lsep">|</span><a href="/posts/14423257/edit" class="suggest-edit-post" title="revise and improve this post">edit</a><span class="lsep">|</span><a href="#"
class="flag-post-link"
title="flag this post for serious problems or moderator attention"
data-postid="14423257">flag</a></div>
</div>
<div class="post-signature grid--cell">
<div class="user-info user-hover">
<div class="user-action-time">
<a href="/posts/14423257/revisions" title="show all edits to this post">edited <span title="2015-12-24 12:45:45Z" class="relativetime">Dec 24 '15 at 12:45</span></a>
</div>
<div class="user-gravatar32">
<a href="/users/4370109/brian-tompsett-%e6%b1%a4%e8%8e%b1%e6%81%a9"><div class="gravatar-wrapper-32"><img src="https://i.stack.imgur.com/UcQgO.jpg?s=32&g=1" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details">
<a href="/users/4370109/brian-tompsett-%e6%b1%a4%e8%8e%b1%e6%81%a9">Brian Tompsett - 汤莱恩</a>
<div class="-flair">
<span class="reputation-score" title="reputation score " dir="ltr">4,452</span><span title="14 gold badges" aria-hidden="true"><span class="badge1"></span><span class="badgecount">14</span></span><span class="v-visible-sr">14 gold badges</span><span title="40 silver badges" aria-hidden="true"><span class="badge2"></span><span class="badgecount">40</span></span><span class="v-visible-sr">40 silver badges</span><span title="108 bronze badges" aria-hidden="true"><span class="badge3"></span><span class="badgecount">108</span></span><span class="v-visible-sr">108 bronze badges</span>
</div>
</div>
</div> </div>
<div class="post-signature owner grid--cell">
<div class="user-info ">
<div class="user-action-time">
asked <span title="2013-01-20 09:34:22Z" class="relativetime">Jan 20 '13 at 9:34</span>
</div>
<div class="user-gravatar32">
<a href="/users/647909/youss"><div class="gravatar-wrapper-32"><img src="https://www.gravatar.com/avatar/a25b798608cf4fde89e9bd3bbf145120?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details" itemprop="author" itemscope itemtype="http://schema.org/Person">
<a href="/users/647909/youss">Youss</a><span class="d-none" itemprop="name">Youss</span>
<div class="-flair">
<span class="reputation-score" title="reputation score " dir="ltr">2,080</span><span title="11 gold badges" aria-hidden="true"><span class="badge1"></span><span class="badgecount">11</span></span><span class="v-visible-sr">11 gold badges</span><span title="42 silver badges" aria-hidden="true"><span class="badge2"></span><span class="badgecount">42</span></span><span class="v-visible-sr">42 silver badges</span><span title="95 bronze badges" aria-hidden="true"><span class="badge3"></span><span class="badgecount">95</span></span><span class="v-visible-sr">95 bronze badges</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="js-post-notices post-layout--full">
</div>
<div class="post-layout--right">
<div id="comments-14423257" class="comments js-comments-container " data-post-id="14423257" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="2"
data-canpost="true"
data-cansee="false"
data-comments-unavailable="false"
data-addlink-disabled="false">
<li id="comment-20076118" class="comment js-comment " data-comment-id="20076118">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">Please add a sample response you're getting from querying file.php</span>
– <a href="/users/80720/rafael"
title="16,762 reputation"
class="comment-user">Rafael</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 09:36:10Z" class="relativetime-clean">Jan 20 '13 at 9:36</span></span>
</div>
</div>
</li>
<li id="comment-20076129" class="comment js-comment " data-comment-id="20076129">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">@Rafael You mean my console log?</span>
– <a href="/users/647909/youss"
title="2,080 reputation"
class="comment-user owner">Youss</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 09:37:40Z" class="relativetime-clean">Jan 20 '13 at 9:37</span></span>
</div>
</div>
</li>
<li id="comment-20076140" class="comment js-comment " data-comment-id="20076140">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">It can be <code>console.log(data)</code> or anything that shows the complete string you received with the ajax call.</span>
– <a href="/users/80720/rafael"
title="16,762 reputation"
class="comment-user">Rafael</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 09:39:34Z" class="relativetime-clean">Jan 20 '13 at 9:39</span></span>
</div>
</div>
</li>
<li id="comment-20076168" class="comment js-comment " data-comment-id="20076168">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
<span title="number of 'useful comment' votes received"
class="cool">1</span>
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">I just checked, with simplified code, and different pages, and can confirm I am experiencing the same issue. It works to select elements within the <code>body</code> but not to select the <code>body</code> itself.</span>
– <a href="/users/665261/billy-moon"
title="42,207 reputation"
class="comment-user">Billy Moon</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 09:42:38Z" class="relativetime-clean">Jan 20 '13 at 9:42</span></span>
</div>
</div>
</li>
<li id="comment-20076206" class="comment js-comment " data-comment-id="20076206">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">@Rafael Im not sure but I think it has to be an url (fom input.val) This could be any url.</span>
– <a href="/users/647909/youss"
title="2,080 reputation"
class="comment-user owner">Youss</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 09:46:00Z" class="relativetime-clean">Jan 20 '13 at 9:46</span></span>
</div>
</div>
</li>
</ul>
<div class="comment-form">
<form id="add-comment-14423257"
class=""
data-placeholdertext="Use comments to ask for more information or suggest improvements. Avoid answering questions in comments."></form>
</div>
</div>
<div id="comments-link-14423257" >
<a class="js-add-link comments-link "
title="Use comments to ask for more information or suggest improvements. Avoid answering questions in comments."
href=#>add a comment</a><span class="js-link-separator "> | </span>
<a class="js-show-link comments-link " title="expand to show all comments on this post" href=# onclick="">show <b>2</b> more comments</a>
</div>
</div> <div class="bounty-notification post-layout--right">
<div style="margin-top:20px">
<a class="bounty-link bounty" title="offer some of your reputation for better answers">
start a bounty
</a>
</div>
</div>
</div>
</div>
<div id="answers">
<a name="tab-top"></a>
<div id="answers-header">
<div class="subheader answers-subheader">
<h2 data-answercount="4">
4 Answers
<span style="display:none;" itemprop="answerCount">4</span>
</h2>
<div>
<div id="tabs">
<a href="/questions/14423257/find-body-tag-in-an-ajax-html-response?answertab=active#tab-top" data-nav-xhref="" title="Answers with the latest activity first" data-value="active" data-shortcut="A">
active</a>
<a href="/questions/14423257/find-body-tag-in-an-ajax-html-response?answertab=oldest#tab-top" data-nav-xhref="" title="Answers in the order they were provided" data-value="oldest" data-shortcut="O">
oldest</a>
<a class="youarehere is-selected " href="/questions/14423257/find-body-tag-in-an-ajax-html-response?answertab=votes#tab-top" data-nav-xhref="" title="Answers with the highest score first" data-value="votes" data-shortcut="V">
votes</a>
</div>
</div>
</div>
</div>
<a name="14423290"></a>
<div id="answer-14423290" class="answer accepted-answer" data-answerid="14423290" itemprop="acceptedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid fd-column ai-stretch gs4 fc-black-200" data-post-id="14423290">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer" title="This answer is useful (click again to undo)" aria-pressed="false" aria-label="up vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowUpLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center" itemprop="upvoteCount" data-value="9">9</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" title="This answer is not useful (click again to undo)" aria-pressed="false" aria-label="down vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowDownLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2 10z"/></svg></button>
<div class="js-accepted-answer-indicator grid--item fc-green-500 ta-center p4" title="loading when this answer was accepted..." tabindex="0" role="note" aria-label="accepted"><svg aria-hidden="true" class="svg-icon iconCheckmarkLg" width="36" height="36" viewBox="0 0 36 36"><path d="M6 14l8 8L30 6v8L14 30l-8-8v-8z"/></svg></div>
</div>
</div>
<div class="answercell post-layout--right">
<div class="post-text" itemprop="text">
<p>Parsing the returned HTML through a jQuery object (i.e <code>$(data)</code>) in order to get the <code>body</code> tag is doomed to fail, I'm afraid.</p>
<p>The reason is that the returned <code>data</code> is a <code>string</code> (try <code>console.log(typeof(data))</code>). Now, according to <a href="http://api.jquery.com/jQuery/#jQuery2">the jQuery documentation</a>, when creating a jQuery object from a string containing complex HTML markup, tags such as <code>body</code> are likely to get stripped. This happens since in order to create the object, the HTML markup is actually inserted into the DOM which cannot allow such additional tags.</p>
<p>Relevant quote from <a href="http://api.jquery.com/jQuery/#jQuery2">the documentation</a>:</p>
<blockquote>
<p>If a string is passed as the parameter to $(), jQuery examines the string to see if it looks like HTML.</p>
<p>[...]
If the HTML is more complex than a single tag without attributes, as it is in the above example, the actual creation of the elements is handled by the browser's innerHTML mechanism. In most cases, jQuery creates a new element and sets the innerHTML property of the element to the HTML snippet that was passed in. When the parameter has a single tag (with optional closing tag or quick-closing) — $( "< img / >" ) or $( "< img >" ), $( "< a >< /a >" ) or $( "< a >" ) — jQuery creates the element using the native JavaScript createElement() function.</p>
<p>When passing in complex HTML, some browsers may not generate a DOM
that exactly replicates the HTML source provided. As mentioned, jQuery
uses the browser"s .innerHTML property to parse the passed HTML and
insert it into the current document. During this process, some
browsers filter out certain elements such as < html >, < title >, or
< head > elements. As a result, the elements inserted may not be
representative of the original string passed.</p>
</blockquote>
</div>
<div class="grid mb0 fw-wrap ai-start jc-end gs8 gsy">
<time itemprop="dateCreated" datetime="2013-01-20T09:39:27"></time>
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu"><a href="/a/14423290/4563136" title="short permalink to this answer" class="short-link" itemprop="url" id="link-post-14423290">share</a><span class="lsep">|</span><a href="/posts/14423290/edit" class="suggest-edit-post" title="revise and improve this post">edit</a><span class="lsep">|</span><a href="#"
class="flag-post-link"
title="flag this post for serious problems or moderator attention"
data-postid="14423290">flag</a></div> </div>
<div class="post-signature grid--cell fl0">
<div class="user-info ">
<div class="user-action-time">
<a href="/posts/14423290/revisions" title="show all edits to this post">edited <span title="2013-01-22 11:55:07Z" class="relativetime">Jan 22 '13 at 11:55</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<div class="-flair">
</div>
</div>
</div> </div>
<div class="post-signature grid--cell fl0">
<div class="user-info user-hover">
<div class="user-action-time">
answered <span title="2013-01-20 09:39:27Z" class="relativetime">Jan 20 '13 at 9:39</span>
</div>
<div class="user-gravatar32">
<a href="/users/1889273/boaz"><div class="gravatar-wrapper-32"><img src="https://i.stack.imgur.com/py8eH.png?s=32&g=1" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details" itemprop="author" itemscope itemtype="http://schema.org/Person">
<a href="/users/1889273/boaz">Boaz</a><span class="d-none" itemprop="name">Boaz</span>
<div class="-flair">
<span class="reputation-score" title="reputation score 15,641" dir="ltr">15.6k</span><span title="7 gold badges" aria-hidden="true"><span class="badge1"></span><span class="badgecount">7</span></span><span class="v-visible-sr">7 gold badges</span><span title="47 silver badges" aria-hidden="true"><span class="badge2"></span><span class="badgecount">47</span></span><span class="v-visible-sr">47 silver badges</span><span title="57 bronze badges" aria-hidden="true"><span class="badge3"></span><span class="badgecount">57</span></span><span class="v-visible-sr">57 bronze badges</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="js-post-notices post-layout--full">
</div>
<div class="post-layout--right">
<div id="comments-14423290" class="comments js-comments-container " data-post-id="14423290" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="true"
data-cansee="false"
data-comments-unavailable="false"
data-addlink-disabled="false">
<li id="comment-20076191" class="comment js-comment " data-comment-id="20076191">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
<span title="number of 'useful comment' votes received"
class="cool">2</span>
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">Thanks but it doesn't work for me</span>
– <a href="/users/647909/youss"
title="2,080 reputation"
class="comment-user owner">Youss</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 09:44:52Z" class="relativetime-clean">Jan 20 '13 at 9:44</span></span>
</div>
</div>
</li>
<li id="comment-20101947" class="comment js-comment " data-comment-id="20101947">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">If you find a relevant workaround, post it as an answer as well.</span>
– <a href="/users/1889273/boaz"
title="15,641 reputation"
class="comment-user">Boaz</a>
<span class="comment-date" dir="ltr"><span title="2013-01-21 11:58:43Z" class="relativetime-clean">Jan 21 '13 at 11:58</span></span>
<span title="this comment was edited 1 time">
<svg aria-hidden="true" class="svg-icon va-text-bottom o50 iconPencilSm" width="14" height="14" viewBox="0 0 14 14"><path d="M11.1 1.71l1.13 1.12c.2.2.2.51 0 .71L11.1 4.7 9.21 2.86l1.17-1.15c.2-.2.51-.2.71 0zM2 10.12l6.37-6.43 1.88 1.88L3.88 12H2v-1.88z"/></svg>
</span>
</div>
</div>
</li>
<li id="comment-41703833" class="comment js-comment " data-comment-id="41703833">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
<span title="number of 'useful comment' votes received"
class="cool">1</span>
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">I disagree that it's doomed to fail! The solution that I've posted to this answer works perfectly and is as convenient as anything else in jquery.</span>
– <a href="/users/830905/gershom-maes"
title="2,179 reputation"
class="comment-user">Gershom Maes</a>
<span class="comment-date" dir="ltr"><span title="2014-10-23 23:46:29Z" class="relativetime-clean">Oct 23 '14 at 23:46</span></span>
</div>
</div>
</li>
<li id="comment-41733531" class="comment js-comment " data-comment-id="41733531">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">@GershomMaes The issue raised by the OP is about <i>directly</i> parsing the returned HTML string. Your solution, while being a neat trick, works around this issue by <i>indirectly</i> parsing the HTML string as an XML document first. This does not negate the fact that directly parsing the HTML strips the <code>body</code> tag.</span>
– <a href="/users/1889273/boaz"
title="15,641 reputation"
class="comment-user">Boaz</a>
<span class="comment-date" dir="ltr"><span title="2014-10-24 20:45:38Z" class="relativetime-clean">Oct 24 '14 at 20:45</span></span>
<span title="this comment was edited 3 times">
<svg aria-hidden="true" class="svg-icon va-text-bottom o50 iconPencilSm" width="14" height="14" viewBox="0 0 14 14"><path d="M11.1 1.71l1.13 1.12c.2.2.2.51 0 .71L11.1 4.7 9.21 2.86l1.17-1.15c.2-.2.51-.2.71 0zM2 10.12l6.37-6.43 1.88 1.88L3.88 12H2v-1.88z"/></svg>
</span>
</div>
</div>
</li>
</ul>
<div class="comment-form">
<form id="add-comment-14423290"
class=""
data-placeholdertext="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></form>
</div>
</div>
<div id="comments-link-14423290" >
<a class="js-add-link comments-link "
title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."
href=#>add a comment</a><span class="js-link-separator dno"> | </span>
<a class="js-show-link comments-link dno" title="expand to show all comments on this post" href=# onclick=""></a>
</div>
</div> </div>
</div>
<a name="35157782"></a>
<div id="answer-35157782" class="answer" data-answerid="35157782" itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid fd-column ai-stretch gs4 fc-black-200" data-post-id="35157782">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer" title="This answer is useful (click again to undo)" aria-pressed="false" aria-label="up vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowUpLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center" itemprop="upvoteCount" data-value="11">11</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" title="This answer is not useful (click again to undo)" aria-pressed="false" aria-label="down vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowDownLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2 10z"/></svg></button>
<div class="js-accepted-answer-indicator grid--item fc-green-500 ta-center p4 d-none" title="loading when this answer was accepted..." tabindex="0" role="note" aria-label="accepted"><svg aria-hidden="true" class="svg-icon iconCheckmarkLg" width="36" height="36" viewBox="0 0 36 36"><path d="M6 14l8 8L30 6v8L14 30l-8-8v-8z"/></svg></div>
</div>
</div>
<div class="answercell post-layout--right">
<div class="post-text" itemprop="text">
<p>I ended up with this simple solution:</p>
<pre><code>var body = data.substring(data.indexOf("<body>")+6,data.indexOf("</body>"));
$('body').html(body);
</code></pre>
<p>Works also with <strong>head</strong> or any other <strong>tag</strong>.</p>
<p>(A solution with xml parsing would be nicer but with an invalid XML response you have to do some "string parsing".)</p>
</div>
<div class="grid mb0 fw-wrap ai-start jc-end gs8 gsy">
<time itemprop="dateCreated" datetime="2016-02-02T15:44:31"></time>
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu"><a href="/a/35157782/4563136" title="short permalink to this answer" class="short-link" itemprop="url" id="link-post-35157782">share</a><span class="lsep">|</span><a href="/posts/35157782/edit" class="suggest-edit-post" title="revise and improve this post">edit</a><span class="lsep">|</span><a href="#"
class="flag-post-link"
title="flag this post for serious problems or moderator attention"
data-postid="35157782">flag</a></div> </div>
<div class="post-signature grid--cell fl0">
<div class="user-info ">
<div class="user-action-time">
<a href="/posts/35157782/revisions" title="show all edits to this post">edited <span title="2016-07-06 15:23:41Z" class="relativetime">Jul 6 '16 at 15:23</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<div class="-flair">
</div>
</div>
</div> </div>
<div class="post-signature grid--cell fl0">
<div class="user-info ">
<div class="user-action-time">
answered <span title="2016-02-02 15:44:31Z" class="relativetime">Feb 2 '16 at 15:44</span>
</div>
<div class="user-gravatar32">
<a href="/users/1479958/yush0"><div class="gravatar-wrapper-32"><img src="https://www.gravatar.com/avatar/9c5d0a96318ea0330a6df6868c4ea997?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details" itemprop="author" itemscope itemtype="http://schema.org/Person">
<a href="/users/1479958/yush0">Yush0</a><span class="d-none" itemprop="name">Yush0</span>
<div class="-flair">
<span class="reputation-score" title="reputation score " dir="ltr">736</span><span title="6 silver badges" aria-hidden="true"><span class="badge2"></span><span class="badgecount">6</span></span><span class="v-visible-sr">6 silver badges</span><span title="19 bronze badges" aria-hidden="true"><span class="badge3"></span><span class="badgecount">19</span></span><span class="v-visible-sr">19 bronze badges</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="js-post-notices post-layout--full">
</div>
<div class="post-layout--right">
<div id="comments-35157782" class="comments js-comments-container " data-post-id="35157782" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="true"
data-cansee="false"
data-comments-unavailable="false"
data-addlink-disabled="false">
<li id="comment-84467575" class="comment js-comment " data-comment-id="84467575">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
<span title="number of 'useful comment' votes received"
class="cool">1</span>
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">That won't work if the body tag has anything extra like you get from MS Word, e.g. <body lang=EN-GB style='tab-interval:36.0pt'>.</span>
– <a href="/users/7073944/vanquished-wombat"
title="4,120 reputation"
class="comment-user">Vanquished Wombat</a>
<span class="comment-date" dir="ltr"><span title="2018-02-11 17:19:08Z" class="relativetime-clean">Feb 11 '18 at 17:19</span></span>
</div>
</div>
</li>
</ul>
<div class="comment-form">
<form id="add-comment-35157782"
class=""
data-placeholdertext="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></form>
</div>
</div>
<div id="comments-link-35157782" >
<a class="js-add-link comments-link "
title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."
href=#>add a comment</a><span class="js-link-separator dno"> | </span>
<a class="js-show-link comments-link dno" title="expand to show all comments on this post" href=# onclick=""></a>
</div>
</div> </div>
</div>
<a name="14423412"></a>
<div id="answer-14423412" class="answer" data-answerid="14423412" itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid fd-column ai-stretch gs4 fc-black-200" data-post-id="14423412">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer" title="This answer is useful (click again to undo)" aria-pressed="false" aria-label="up vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowUpLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center" itemprop="upvoteCount" data-value="6">6</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" title="This answer is not useful (click again to undo)" aria-pressed="false" aria-label="down vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowDownLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2 10z"/></svg></button>
<div class="js-accepted-answer-indicator grid--item fc-green-500 ta-center p4 d-none" title="loading when this answer was accepted..." tabindex="0" role="note" aria-label="accepted"><svg aria-hidden="true" class="svg-icon iconCheckmarkLg" width="36" height="36" viewBox="0 0 36 36"><path d="M6 14l8 8L30 6v8L14 30l-8-8v-8z"/></svg></div>
</div>
</div>
<div class="answercell post-layout--right">
<div class="post-text" itemprop="text">
<p>I experimented a little, and have identified the cause to a point, so pending a real answer which I would be interested in, here is a hack to help understand the issue</p>
<pre><code>$.get('/',function(d){
// replace the \`HTML\` tags with \`NOTHTML\` tags
// and the \`BODY\` tags with \`NOTBODY\` tags
d = d.replace(/(<\/?)html( .+?)?>/gi,'$1NOTHTML$2>',d)
d = d.replace(/(<\/?)body( .+?)?>/gi,'$1NOTBODY$2>',d)
// select the \`notbody\` tag and log for testing
console.log($(d).find('notbody').html())
})
</code></pre>
<h2>Edit: further experimentation</h2>
<p>It seems it is possible if you load the content into an iframe, then you can access the frame content through some dom object hierarchy...</p>
<pre><code>// get a page using AJAX
$.get('/',function(d){
// create a temporary \`iframe\`, make it hidden, and attach to the DOM
var frame = $('<iframe id="frame" src="/" style="display: none;"></iframe>').appendTo('body')
// check that the frame has loaded content
$(frame).load(function(){
// grab the HTML from the body, using the raw DOM node (frame[0])
// and more specifically, it's \`contentDocument\` property
var html = $('body',frame[0].contentDocument).html()
// check the HTML
console.log(html)
// remove the temporary iframe
$("#frame").remove()
})
})
</code></pre>
<h2>Edit: more research</h2>
<p>It seems that contentDocument is the standards compliant way to get hold of the <code>window.document</code> element of an iFrame, but of course IE don't really care for standards, so this is how to get a reference to the iFrame's <code>window.document.body</code> object in a cross platform way...</p>
<pre><code>var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
var iframeBody = iframeDoc.body;
// or for extra caution, to support even more obsolete browsers
// var iframeBody = iframeDoc.getElementsByTagName("body")[0]
</code></pre>
<p>See: <a href="https://stackoverflow.com/q/6581803/665261">contentDocument for an iframe</a></p>
</div>
<div class="grid mb0 fw-wrap ai-start jc-end gs8 gsy">
<time itemprop="dateCreated" datetime="2013-01-20T10:00:53"></time>
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu"><a href="/a/14423412/4563136" title="short permalink to this answer" class="short-link" itemprop="url" id="link-post-14423412">share</a><span class="lsep">|</span><a href="/posts/14423412/edit" class="suggest-edit-post" title="revise and improve this post">edit</a><span class="lsep">|</span><a href="#"
class="flag-post-link"
title="flag this post for serious problems or moderator attention"
data-postid="14423412">flag</a></div> </div>
<div class="post-signature grid--cell fl0">
<div class="user-info user-hover">
<div class="user-action-time">
<a href="/posts/14423412/revisions" title="show all edits to this post">edited <span title="2017-05-23 12:25:51Z" class="relativetime">May 23 '17 at 12:25</span></a>
</div>
<div class="user-gravatar32">
<a href="/users/-1/community"><div class="gravatar-wrapper-32"><img src="https://www.gravatar.com/avatar/a007be5a61f6aa8f3e85ae2fc18dd66e?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details">
<a href="/users/-1/community">Community</a><span class="mod-flair" title="moderator">♦</span>
<div class="-flair">
<span class="reputation-score" title="reputation score " dir="ltr">1</span><span title="1 silver badge" aria-hidden="true"><span class="badge2"></span><span class="badgecount">1</span></span><span class="v-visible-sr">1 silver badge</span>
</div>
</div>
</div> </div>
<div class="post-signature grid--cell fl0">
<div class="user-info user-hover">
<div class="user-action-time">
answered <span title="2013-01-20 10:00:53Z" class="relativetime">Jan 20 '13 at 10:00</span>
</div>
<div class="user-gravatar32">
<a href="/users/665261/billy-moon"><div class="gravatar-wrapper-32"><img src="https://www.gravatar.com/avatar/bae67d1482c1a667677ef18aafe0505d?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details" itemprop="author" itemscope itemtype="http://schema.org/Person">
<a href="/users/665261/billy-moon">Billy Moon</a><span class="d-none" itemprop="name">Billy Moon</span>
<div class="-flair">
<span class="reputation-score" title="reputation score 42,207" dir="ltr">42.2k</span><span title="19 gold badges" aria-hidden="true"><span class="badge1"></span><span class="badgecount">19</span></span><span class="v-visible-sr">19 gold badges</span><span title="101 silver badges" aria-hidden="true"><span class="badge2"></span><span class="badgecount">101</span></span><span class="v-visible-sr">101 silver badges</span><span title="203 bronze badges" aria-hidden="true"><span class="badge3"></span><span class="badgecount">203</span></span><span class="v-visible-sr">203 bronze badges</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="js-post-notices post-layout--full">
</div>
<div class="post-layout--right">
<div id="comments-14423412" class="comments js-comments-container " data-post-id="14423412" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="4"
data-canpost="true"
data-cansee="false"
data-comments-unavailable="false"
data-addlink-disabled="false">
<li id="comment-20076527" class="comment js-comment " data-comment-id="20076527">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">additionally, it does not seem to make any diference what syntax you use for the selector, as it seems to be a restriction in the jQuery core, so <code>$('body',d)</code> has the same results as <code>$(d).find('body')</code>.</span>
– <a href="/users/665261/billy-moon"
title="42,207 reputation"
class="comment-user">Billy Moon</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 10:15:37Z" class="relativetime-clean">Jan 20 '13 at 10:15</span></span>
</div>
</div>
</li>
<li id="comment-20076844" class="comment js-comment " data-comment-id="20076844">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">Hi, thanks for sticking around. However I want to use my code for any given website, as we know some websites do not support iframes..</span>
– <a href="/users/647909/youss"
title="2,080 reputation"
class="comment-user owner">Youss</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 10:43:38Z" class="relativetime-clean">Jan 20 '13 at 10:43</span></span>
</div>
</div>
</li>
<li id="comment-20076856" class="comment js-comment " data-comment-id="20076856">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">Maybe it doesnt work in 'jquery environment' and I would have to result to plain javascript. I have been trying variations with <code>document.getElementsByTagName("body")[0];</code> with no luck so far</span>
– <a href="/users/647909/youss"
title="2,080 reputation"
class="comment-user owner">Youss</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 10:44:46Z" class="relativetime-clean">Jan 20 '13 at 10:44</span></span>
<span title="this comment was edited 1 time">
<svg aria-hidden="true" class="svg-icon va-text-bottom o50 iconPencilSm" width="14" height="14" viewBox="0 0 14 14"><path d="M11.1 1.71l1.13 1.12c.2.2.2.51 0 .71L11.1 4.7 9.21 2.86l1.17-1.15c.2-.2.51-.2.71 0zM2 10.12l6.37-6.43 1.88 1.88L3.88 12H2v-1.88z"/></svg>
</span>
</div>
</div>
</li>
<li id="comment-20076980" class="comment js-comment " data-comment-id="20076980">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">I think the problem is, that you can't add another <code>HTML</code>, <code>HEAD</code> or <code>BODY</code> to the DOM. If you try to set the <code>.innerHTML</code> of a <code>DIV</code> tag to include any of these forbidden elements, it simply won't add them - which is why I expect jQuery is not able to then select them.</span>
– <a href="/users/665261/billy-moon"
title="42,207 reputation"
class="comment-user">Billy Moon</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 10:55:06Z" class="relativetime-clean">Jan 20 '13 at 10:55</span></span>
</div>
</div>
</li>
<li id="comment-20077621" class="comment js-comment " data-comment-id="20077621">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">@Youss could you explain to me what websites don't support iframes? I had thought they were pretty much universally supported these days.</span>
– <a href="/users/665261/billy-moon"
title="42,207 reputation"
class="comment-user">Billy Moon</a>
<span class="comment-date" dir="ltr"><span title="2013-01-20 11:48:38Z" class="relativetime-clean">Jan 20 '13 at 11:48</span></span>
</div>
</div>
</li>
</ul>
<div class="comment-form">
<form id="add-comment-14423412"
class=""
data-placeholdertext="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></form>
</div>
</div>
<div id="comments-link-14423412" >
<a class="js-add-link comments-link "
title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."
href=#>add a comment</a><span class="js-link-separator "> | </span>
<a class="js-show-link comments-link " title="expand to show all comments on this post" href=# onclick="">show <b>4</b> more comments</a>
</div>
</div> </div>
</div>
<a name="23876751"></a>
<div id="answer-23876751" class="answer" data-answerid="23876751" itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid fd-column ai-stretch gs4 fc-black-200" data-post-id="23876751">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer" title="This answer is useful (click again to undo)" aria-pressed="false" aria-label="up vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowUpLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column ai-center" itemprop="upvoteCount" data-value="5">5</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" title="This answer is not useful (click again to undo)" aria-pressed="false" aria-label="down vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="svg-icon m0 iconArrowDownLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2 10z"/></svg></button>
<div class="js-accepted-answer-indicator grid--item fc-green-500 ta-center p4 d-none" title="loading when this answer was accepted..." tabindex="0" role="note" aria-label="accepted"><svg aria-hidden="true" class="svg-icon iconCheckmarkLg" width="36" height="36" viewBox="0 0 36 36"><path d="M6 14l8 8L30 6v8L14 30l-8-8v-8z"/></svg></div>
</div>
</div>
<div class="answercell post-layout--right">
<div class="post-text" itemprop="text">
<p>I FIGURED OUT SOMETHING WONDERFUL (I think!)</p>
<p>Got your html as a string?</p>
<pre><code>var results = //probably an ajax response
</code></pre>
<p>Here's a jquery object that will work exactly like the elements currently attached to the DOM:</p>
<pre><code>var superConvenient = $($.parseXML(response)).children('html');
</code></pre>
<p>Nothing will be stripped from <code>superConvenient</code>! You can do stuff like <code>superConvenient.find('body')</code> or even</p>
<pre><code>superConvenient.find('head > script');
</code></pre>
<p><code>superConvenient</code> works exactly like the jquery elements everyone is used to!!!!</p>
<h1>NOTE</h1>
<p>In this case the string <code>results</code> needs to be <em>valid XML</em> because it is fed to JQuery's <code>parseXML</code> method. A common feature of an HTML response may be a <code><!DOCTYPE></code> tag, which would invalidate the document in this sense. <code><!DOCTYPE></code> tags may need to be stripped before using this approach! Also watch out for features such as <code><!--[if IE 8]>...<![endif]--></code>, tags without closing tags, e.g.:</p>
<pre><code><ul>
<li>content...
<li>content...
<li>content...
</ul>
</code></pre>
<p>... and any other features of HTML that will be interpreted leniently by browsers, but will crash the XML parser.</p>
</div>
<div class="grid mb0 fw-wrap ai-start jc-end gs8 gsy">
<time itemprop="dateCreated" datetime="2014-05-26T19:41:31"></time>
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu"><a href="/a/23876751/4563136" title="short permalink to this answer" class="short-link" itemprop="url" id="link-post-23876751">share</a><span class="lsep">|</span><a href="/posts/23876751/edit" class="suggest-edit-post" title="revise and improve this post">edit</a><span class="lsep">|</span><a href="#"
class="flag-post-link"
title="flag this post for serious problems or moderator attention"
data-postid="23876751">flag</a></div> </div>
<div class="post-signature grid--cell fl0">
<div class="user-info ">
<div class="user-action-time">
<a href="/posts/23876751/revisions" title="show all edits to this post">edited <span title="2016-02-04 15:49:18Z" class="relativetime">Feb 4 '16 at 15:49</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<div class="-flair">
</div>
</div>
</div> </div>
<div class="post-signature grid--cell fl0">
<div class="user-info user-hover">
<div class="user-action-time">
answered <span title="2014-05-26 19:41:31Z" class="relativetime">May 26 '14 at 19:41</span>
</div>
<div class="user-gravatar32">
<a href="/users/830905/gershom-maes"><div class="gravatar-wrapper-32"><img src="https://www.gravatar.com/avatar/b4baf2e9d3a2a599d763a602fa4f2be1?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
</div>
<div class="user-details" itemprop="author" itemscope itemtype="http://schema.org/Person">
<a href="/users/830905/gershom-maes">Gershom Maes</a><span class="d-none" itemprop="name">Gershom Maes</span>
<div class="-flair">
<span class="reputation-score" title="reputation score " dir="ltr">2,179</span><span title="14 silver badges" aria-hidden="true"><span class="badge2"></span><span class="badgecount">14</span></span><span class="v-visible-sr">14 silver badges</span><span title="32 bronze badges" aria-hidden="true"><span class="badge3"></span><span class="badgecount">32</span></span><span class="v-visible-sr">32 bronze badges</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="js-post-notices post-layout--full">
</div>
<div class="post-layout--right">
<div id="comments-23876751" class="comments js-comments-container " data-post-id="23876751" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="4"
data-canpost="true"
data-cansee="false"
data-comments-unavailable="false"
data-addlink-disabled="false">
<li id="comment-41555413" class="comment js-comment " data-comment-id="41555413">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">this works great...</span>
– <a href="/users/859491/mitch-vanduyn"
title="2,052 reputation"
class="comment-user">Mitch VanDuyn</a>
<span class="comment-date" dir="ltr"><span title="2014-10-20 02:14:19Z" class="relativetime-clean">Oct 20 '14 at 2:14</span></span>
</div>
</div>
</li>
<li id="comment-41556522" class="comment js-comment " data-comment-id="41556522">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">Great! I'm glad that anyone's getting some use out of this since I was personally browbeaten by the time I stumbled across this solution :)</span>
– <a href="/users/830905/gershom-maes"
title="2,179 reputation"
class="comment-user">Gershom Maes</a>
<span class="comment-date" dir="ltr"><span title="2014-10-20 03:44:47Z" class="relativetime-clean">Oct 20 '14 at 3:44</span></span>
<span title="this comment was edited 1 time">
<svg aria-hidden="true" class="svg-icon va-text-bottom o50 iconPencilSm" width="14" height="14" viewBox="0 0 14 14"><path d="M11.1 1.71l1.13 1.12c.2.2.2.51 0 .71L11.1 4.7 9.21 2.86l1.17-1.15c.2-.2.51-.2.71 0zM2 10.12l6.37-6.43 1.88 1.88L3.88 12H2v-1.88z"/></svg>
</span>
</div>
</div>
</li>
<li id="comment-41733682" class="comment js-comment " data-comment-id="41733682">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">+1 Though there's an obvious overhead, since the HTML string is being parsed twice, instead of once. With large HTML documents this might be costly.</span>
– <a href="/users/1889273/boaz"
title="15,641 reputation"
class="comment-user">Boaz</a>
<span class="comment-date" dir="ltr"><span title="2014-10-24 20:51:49Z" class="relativetime-clean">Oct 24 '14 at 20:51</span></span>
</div>
</div>
</li>
<li id="comment-45566706" class="comment js-comment " data-comment-id="45566706">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">The jQuery XML parser says the html starting with '<!DOCTYPE HTML> <!--[if lt IE 7]><html ...' is invalid. I tried to remove the DOCTYPE bit to be sure it starts with a HTML tag without much success. Still +1 for the neat idea.</span>
– <a href="/users/144227/ziad"
title="761 reputation"
class="comment-user">Ziad</a>
<span class="comment-date" dir="ltr"><span title="2015-02-20 16:12:57Z" class="relativetime-clean">Feb 20 '15 at 16:12</span></span>
<span title="this comment was edited 7 times">
<svg aria-hidden="true" class="svg-icon va-text-bottom o50 iconPencilSm" width="14" height="14" viewBox="0 0 14 14"><path d="M11.1 1.71l1.13 1.12c.2.2.2.51 0 .71L11.1 4.7 9.21 2.86l1.17-1.15c.2-.2.51-.2.71 0zM2 10.12l6.37-6.43 1.88 1.88L3.88 12H2v-1.88z"/></svg>
</span>
</div>
</div>
</li>
<li id="comment-52775137" class="comment js-comment " data-comment-id="52775137">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
<span title="number of 'useful comment' votes received"
class="cool">2</span>
</div>
<div class="comment-voting mtn2 js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-up comment-up-off" aria-label="Upvote Comment" title="This comment adds something useful to the post">
<svg aria-hidden="true" class="svg-icon iconArrowUp" width="18" height="18" viewBox="0 0 18 18"><path d="M1 13h16L9 5l-8 8z"/></svg>
</a>
</div>
<div class="comment-flagging js-comment-edit-hide">
<a tabindex="0" role="button" href="#" class="comment-flag" aria-label="Flag Comment" title="Flag this comment for serious problems or moderator attention">
<svg aria-hidden="true" class="svg-icon iconFlag" width="18" height="18" viewBox="0 0 18 18"><path d="M3 2v14h2v-6h3.6l.4 1h6V3H9.5L9 2H3z"/></svg>
</a>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
<span class="comment-copy">I used the same code but got an error Uncaught Error: Invalid XML: <head></span>
– <a href="/users/3041868/jnanaranjan"
title="1,026 reputation"
class="comment-user">Jnanaranjan</a>
<span class="comment-date" dir="ltr"><span title="2015-09-08 11:27:36Z" class="relativetime-clean">Sep 8 '15 at 11:27</span></span>
</div>
</div>
</li>
</ul>
<div class="comment-form">
<form id="add-comment-23876751"
class=""
data-placeholdertext="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></form>
</div>
</div>
<div id="comments-link-23876751" >
<a class="js-add-link comments-link "
title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."
href=#>add a comment</a><span class="js-link-separator "> | </span>
<a class="js-show-link comments-link " title="expand to show all comments on this post" href=# onclick="">show <b>4</b> more comments</a>
</div>
</div> </div>
</div>
<aside class="s-notice s-notice__info py8 js-product-notice" role="status" aria-hidden="false">
<div class="grid gs16 gsx ai-center jc-space-between">
<div class="grid--cell">
Got a question that you can’t ask on public Stack Overflow? <a href="/teams" data-ga="["teams suggestion bar","learn more click","answered",null,null]" class="js-gps-track" data-gps-track="teams.question_banner.click">Learn more</a> about sharing private information with Stack Overflow for Teams. </div>
<div class="grid--cell mr0" aria-label="dismiss">
<button class="p8 s-btn grid grid__center fc-dark js-product-notice-close" data-dismiss-entity="1"
data-ga="["teams suggestion bar","dismiss click","answered",null,null]">
<svg aria-hidden="true" class="svg-icon m0 iconClearSm" width="14" height="14" viewBox="0 0 14 14"><path d="M12 3.41L10.59 2 7 5.59 3.41 2 2 3.41 5.59 7 2 10.59 3.41 12 7 8.41 10.59 12 12 10.59 8.41 7 12 3.41z"/></svg>
</button>
</div>
</div>
</aside>
<a name='new-answer'></a>
<form id="post-form" action="/questions/14423257/answer/submit" method="post" class="post-form">
<input type="hidden" id="post-id" value="14423257" />
<input type="hidden" id="qualityBanWarningShown" name="qualityBanWarningShown" value="false" />
<input type="hidden" name="referrer" value="" />
<h2 class="space">
Your Answer
</h2>
<script>
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
</script>
<script>
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: false,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by \u003ca class=\"icon-imgur-white\" href=\"https://imgur.com/\"\u003e\u003c/a\u003e",
contentPolicyHtml: "User contributions licensed under \u003ca href=\"https://creativecommons.org/licenses/by-sa/3.0/\"\u003ecc by-sa 3.0 with attribution required\u003c/a\u003e \u003ca href=\"https://stackoverflow.com/legal/content-policy\"\u003e(content policy)\u003c/a\u003e",
allowUrls: true
},
onDemand: false,
discardSelector: ".discard-answer"
,userId:4563136
});
}
});
</script>
<div id="post-editor" class="post-editor js-post-editor js-wz-element" data-wz-state = "8,16,32,64,128,256">
<div class="ps-relative">
<div class="wmd-container mb8">
<div id="wmd-button-bar" class="wmd-button-bar btr-sm"></div>
<div class="js-stacks-validation">
<div class="ps-relative">
<textarea id="wmd-input" class="wmd-input js-wz-element s-input bar0" name="post-text" cols="92" rows="15" tabindex="101" data-wz-state = "256" data-min-length=""></textarea>
</div>
<div class="s-input-message mt4 d-none js-stacks-validation-message"></div>
</div>
</div>
</div>
<aside class="grid ai-start jc-space-between js-answer-help s-notice s-notice__warning pb0 pr4 pt4 mb8 d-none" role="status" aria-hidden="true">
<div class="grid--cell pt8">
<p>Thanks for contributing an answer to Stack Overflow!</p><ul><li>Please be sure to <em>answer the question</em>. Provide details and share your research!</li></ul><p>But <em>avoid</em> …</p><ul><li>Asking for help, clarification, or responding to other answers.</li><li>Making statements based on opinion; back them up with references or personal experience.</li></ul><p>To learn more, see our <a href="/help/how-to-answer">tips on writing great answers</a>.</p>
</div>
<button class="grid--cell js-answer-help-close-btn s-btn s-btn__muted fc-dark">
<svg aria-hidden="true" class="svg-icon iconClear" width="18" height="18" viewBox="0 0 18 18"><path d="M15 4.41L13.59 3 9 7.59 4.41 3 3 4.41 7.59 9 3 13.59 4.41 15 9 10.41 13.59 15 15 13.59 10.41 9 15 4.41z"/></svg>
</button>
</aside>
<div id="draft-saved" class="draft-saved community-option fl" style="height:24px; display:none;">draft saved</div>
<div id="draft-discarded" class="draft-discarded community-option fl" style="height:24px; display:none;">draft discarded</div>
<div class="community-option g-row ai-center f-checkbox">
<div class="g-col -input">
<input id="communitymode" name="communitymode" type="checkbox" >
</div>
<div class="g-col">
<label for="communitymode" class="f-label _small" title="Marking an answer community wiki encourages others to edit it by lowering the reputation barrier required to edit. However, you will not gain any upvote reputation from it. This cannot be undone.">community wiki</label>
</div>
</div>
<div id="wmd-preview" class="wmd-preview"></div>
<div></div>
<div class="edit-block">
<input id="fkey" name="fkey" type="hidden" value="f6f2ebf21d8ca3adecc9721936e5c65c30c2ee0846c13d2366d2f91f21dff267">
<input id="author" name="author" type="text">
</div>
</div>
<div class="ps-relative">
</div>
<div class="form-submit cbt grid gsx gs4">
<button id="submit-button" class="grid--cell s-btn s-btn__primary s-btn__icon" type="submit" tabindex="120" autocomplete="off">
Post Your Answer </button>
<button class="grid--cell s-btn s-btn__danger discard-answer dno">
Discard
</button>
</div>
</form>
<h2 class="bottom-notice" data-loc="1">
Not the answer you're looking for? Browse other questions tagged <a href="/questions/tagged/javascript" class="post-tag" title="show questions tagged 'javascript'" rel="tag">javascript</a> <a href="/questions/tagged/jquery" class="post-tag" title="show questions tagged 'jquery'" rel="tag">jquery</a> <a href="/questions/tagged/ajax" class="post-tag" title="show questions tagged 'ajax'" rel="tag">ajax</a> <a href="/questions/tagged/document-body" class="post-tag" title="show questions tagged 'document-body'" rel="tag">document-body</a> or <a href="/questions/ask">ask your own question</a>. </h2>
</div>
</div>
<div id="sidebar" class="show-votes" role="complementary" aria-label="sidebar">
<div class="s-sidebarwidget s-sidebarwidget__yellow s-anchors s-anchors__default mb16" data-tracker="cb=1">
<div class="s-sidebarwidget--header s-sidebarwidget__small-bold-text">
Blog
</div>
<ul class="s-sidebarwidget--content s-sidebarwidget__items pt0 pr16 pb0 pl16">
<li class="s-sidebarwidget--item grid">
<div class="grid--cell1 fl-shrink0">
<a href="https://stackoverflow.blog/2019/08/07/what-every-developer-should-learn-early-on/" data-ga="["community bulletin board","Blog","https://stackoverflow.blog/2019/08/07/what-every-developer-should-learn-early-on/",null,null]">
<div class="favicon favicon-stackexchangemeta" title="Meta Stack Exchange"></div> </a>
</div>
<div class="grid--cell">
<a href="https://stackoverflow.blog/2019/08/07/what-every-developer-should-learn-early-on/" data-ga="["community bulletin board","Blog","https://stackoverflow.blog/2019/08/07/what-every-developer-should-learn-early-on/",null,null]">What Every Developer Should Learn Early On</a>
</div>
</li>
</ul>
<ul class="s-sidebarwidget--content s-sidebarwidget__items pt0 pr16 pb0 pl16">
<li class="s-sidebarwidget--item grid">
<div class="grid--cell1 fl-shrink0">
<a href="https://stackoverflow.blog/2019/08/08/def-con-stack-overflow-traffic-data-trends/" data-ga="["community bulletin board","Blog","https://stackoverflow.blog/2019/08/08/def-con-stack-overflow-traffic-data-trends/",null,null]">
<div class="favicon favicon-stackexchangemeta" title="Meta Stack Exchange"></div> </a>
</div>
<div class="grid--cell">
<a href="https://stackoverflow.blog/2019/08/08/def-con-stack-overflow-traffic-data-trends/" title="DEF CON and Stack Overflow: What Our Traffic Says About Cybersecurity Technologies" data-ga="["community bulletin board","Blog","https://stackoverflow.blog/2019/08/08/def-con-stack-overflow-traffic-data-trends/",null,null]">DEF CON and Stack Overflow: What Our Traffic Says About Cybersecurity…</a>
</div>
</li>
</ul>
<div class="s-sidebarwidget--header s-sidebarwidget__small-bold-text">
Featured on Meta
</div>
<ul class="s-sidebarwidget--content s-sidebarwidget__items pt0 pr16 pb0 pl16">
<li class="s-sidebarwidget--item grid">
<div class="grid--cell1 fl-shrink0">
<a href="https://meta.stackexchange.com/questions/331654/employee-profiles-are-now-marked-with-a-staff-indicator" data-ga="["community bulletin board","Featured on Meta","https://meta.stackexchange.com/questions/331654/employee-profiles-are-now-marked-with-a-staff-indicator",null,null]">
<div class="favicon favicon-stackexchangemeta" title="Meta Stack Exchange"></div> </a>
</div>
<div class="grid--cell">
<a href="https://meta.stackexchange.com/questions/331654/employee-profiles-are-now-marked-with-a-staff-indicator" data-ga="["community bulletin board","Featured on Meta","https://meta.stackexchange.com/questions/331654/employee-profiles-are-now-marked-with-a-staff-indicator",null,null]">Employee profiles are now marked with a “Staff” indicator</a>
</div>
</li>
</ul>
<ul class="s-sidebarwidget--content s-sidebarwidget__items pt0 pr16 pb0 pl16">
<li class="s-sidebarwidget--item grid">
<div class="grid--cell1 fl-shrink0">
<a href="https://meta.stackexchange.com/questions/331708/congratulations-to-our-29-oldest-beta-sites-theyre-now-no-longer-beta" data-ga="["community bulletin board","Featured on Meta","https://meta.stackexchange.com/questions/331708/congratulations-to-our-29-oldest-beta-sites-theyre-now-no-longer-beta",null,null]">
<div class="favicon favicon-stackexchangemeta" title="Meta Stack Exchange"></div> </a>
</div>
<div class="grid--cell">
<a href="https://meta.stackexchange.com/questions/331708/congratulations-to-our-29-oldest-beta-sites-theyre-now-no-longer-beta" data-ga="["community bulletin board","Featured on Meta","https://meta.stackexchange.com/questions/331708/congratulations-to-our-29-oldest-beta-sites-theyre-now-no-longer-beta",null,null]">Congratulations to our 29 oldest beta sites - They're now no longer beta!</a>
</div>
</li>
</ul>
<ul class="s-sidebarwidget--content s-sidebarwidget__items pt0 pr16 pb0 pl16">
<li class="s-sidebarwidget--item grid">
<div class="grid--cell1 fl-shrink0">
<a href="https://meta.stackoverflow.com/questions/388321/why-is-an-important-meta-post-tagged-featured-not-showing-in-featured-on-meta" data-ga="["community bulletin board","Featured on Meta","https://meta.stackoverflow.com/questions/388321/why-is-an-important-meta-post-tagged-featured-not-showing-in-featured-on-meta",null,null]">
<div class="favicon favicon-stackoverflowmeta" title="Meta Stack Overflow"></div> </a>
</div>
<div class="grid--cell">
<a href="https://meta.stackoverflow.com/questions/388321/why-is-an-important-meta-post-tagged-featured-not-showing-in-featured-on-meta" title="Why is an important Meta post tagged [featured] not showing in "Featured on Meta"?" data-ga="["community bulletin board","Featured on Meta","https://meta.stackoverflow.com/questions/388321/why-is-an-important-meta-post-tagged-featured-not-showing-in-featured-on-meta",null,null]">Why is an important Meta post tagged [featured] not showing in "Featured on…</a>
</div>
</li>
</ul>
<ul class="s-sidebarwidget--content s-sidebarwidget__items pt0 pr16 pb0 pl16">
<li class="s-sidebarwidget--item grid">
<div class="grid--cell1 fl-shrink0">
<a href="https://meta.stackoverflow.com/questions/388313/experiment-closing-and-reopening-happens-at-3-votes-for-the-next-30-days-until" data-ga="["community bulletin board","Featured on Meta","https://meta.stackoverflow.com/questions/388313/experiment-closing-and-reopening-happens-at-3-votes-for-the-next-30-days-until",null,null]">
<div class="favicon favicon-stackoverflowmeta" title="Meta Stack Overflow"></div> </a>
</div>
<div class="grid--cell">
<a href="https://meta.stackoverflow.com/questions/388313/experiment-closing-and-reopening-happens-at-3-votes-for-the-next-30-days-until" title="Experiment: closing and reopening happens at 3 votes for the next 30 days (until 2019-09-07)" data-ga="["community bulletin board","Featured on Meta","https://meta.stackoverflow.com/questions/388313/experiment-closing-and-reopening-happens-at-3-votes-for-the-next-30-days-until",null,null]">Experiment: closing and reopening happens at 3 votes for the next 30 days…</a>
</div>
</li>
</ul>
</div>
<div id="clc-tsb" class="everyonelovesstackoverflow everyoneloves__top-sidebar"></div>
<div id="hireme"></div>
<script>;try{(function(a){function b(a){return'string'==typeof a?document.getElementById(a):a}function c(a){return a=b(a),!!a&&'none'===getComputedStyle(a).display}function d(a){return!c(a)}function e(a){return!!a}function f(a){return /^\s*$/.test(b(a).innerHTML)}function g(a){var b=a.style;b.height=b.maxHeight=b.minHeight='auto',b.display='none',[].forEach.call(a.children,g)}function h(a,b){var c;return function(){return a&&(c=a.call(b||this,arguments),a=null),c}}function i(a){var b=document.createElement('script');b.src=a,document.body.appendChild(b)}function j(a){return k([],a)}function k(a,b){return a.push=function(a){return b(),delete this.push,this.push(a)},a}function l(){try{return!new Function('return async()=>{};')}catch(a){return!0}}function m(){return'undefined'!=typeof googletag&&!!googletag.apiReady}function n(){m()||(googletag={cmd:j(A)})}function o(){var a=document.createElement('div');a.className='adsbox',a.id='clc-abd',a.style.position='absolute',a.style.pointerEvents='none',a.innerHTML=' ',document.body.appendChild(a)}function p(a){var b=a.serviceName,c=a.slot,d=a.lineItemId;try{var e=c.getSlotElementId(),f=[];e||f.push('id=0');var h=document.getElementById(e);if(!e||h?h.hasAttribute('data-clc-stalled')&&f.push('st=1'):f.push('el=0'),0!==f.length)return void B(f.join('&'));-1===x.dh.indexOf(d)?h.setAttribute('data-clc-prefilled','true'):g(h),h.setAttribute('data-clc-ready','true')}catch(a){var i=document.querySelector('#dfp-tsb, #dfp-isb, #clc-tsb');i&&i.setAttribute('data-clc-ready','true'),B('e=1')}}function q(){return Object.keys(F.ids)}function r(a){var b=F.ids[a],c=F.slots[b];'function'==typeof c&&(c=c(a));return{path:'/'+C+'/'+E+'/'+b+'/'+D,sizes:c,zone:b}}function s(a){return!(clc.collapse&&void 0!==clc.collapse[a])||!!clc.collapse[a]}function t(a,b){'dfp-isb'===a&&b.setTargeting('Sidebar',['Inline']),'dfp-tsb'===a&&b.setTargeting('Sidebar',['Right']);var c=r(a),d=c.path,e=c.sizes,f=c.zone,g=googletag.defineSlot(d,e,a);s(f)&&g.setCollapseEmptyDiv(!0,!0),g.addService(b),!1}function u(b){var c=a.dfp&&a.dfp.targeting||{};Object.keys(c).forEach(function(a){b.setTargeting(a,c[a])})}function v(a){var g=a.map(b).filter(e);return{eligible:g.filter(f).filter(d).map(function(a){return a.id}),ineligible:g.filter(c)}}function w(b){if(void 0===b&&(b=q()),!m())return n(),void googletag.cmd.push(function(){return w(b)});var c=v(b),d=c.eligible,e=c.ineligible;if(e.forEach(g),0!==d.length){o(),googletag.destroySlots();var f=googletag.pubads();x.sf&&(f.setForceSafeFrame(!0),f.setSafeFrameConfig({allowOverlayExpansion:!0,allowPushExpansion:!0,sandbox:!0})),f.enableSingleRequest(),a.sreEvent||(f.addEventListener('slotRenderEnded',p),a.sreEvent=!0),u(f),d.forEach(function(a){return t(a,f)}),googletag.enableServices(),d.forEach(function(a){googletag.display(a)})}}var x=function(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];for(var d,e=0,f=b;e<f.length;e++)for(var g in d=f[e],d)a[g]=d[g];return a}({"lib":"https://cdn.sstatic.net/clc/clc.min.js?v=40b76bc9bf33","style":"https://cdn.sstatic.net/clc/styles/clc.min.css?v=7865eeeae8e2","u":"https://clc.stackoverflow.com/markup.js","wa":true,"kt":2000,"tto":true,"h":"clc.stackoverflow.com","allowed":"^(((talent\\.)?stackoverflow)|(blog\\.codinghorror)|(serverfault|askubuntu)|([^\\.]+\\.stackexchange))\\.com$","wv":true,"al":false,"dh":[4385506061,4386578282,4386579572]},a.options||{}),y=h(function(){var a=x.lib;l()&&(a=a.replace(/(\.min)?\.js(\?v=[0-9a-fA-F]+)?$/,'.ie$1.js$2')),i(a)}),z=a.cmd||[];Array.isArray(z)&&(0<z.length?y():k(z,y));var A=h(function(){i('https://www.googletagservices.com/tag/js/gpt.js')}),B=function(a){new Image().src='https://'+x.h+'/stalled.gif?'+a},C='248424177',D=/^\/tags\//.test(location.pathname)||/^\/questions\/tagged\//.test(location.pathname)?'tag-pages':/^\/$/.test(location.pathname)||/^\/home/.test(location.pathname)?'home-page':'question-pages',E=location.hostname;var F={slots:{lb:[[728,90]],mlb:[[728,90]],smlb:[[728,90]],bmlb:[[728,90]],sb:function(a){return'dfp-tsb'===a?[[300,250],[300,600]]:[[300,250]]},"tag-sponsorship":[[730,135]],"mobile-below-question":[[320,50],[300,250]]},ids:{"dfp-tlb":'lb',"dfp-mlb":'mlb',"dfp-smlb":'smlb',"dfp-bmlb":'bmlb',"dfp-tsb":'sb',"dfp-isb":'sb',"dfp-tag":'tag-sponsorship',"dfp-m-aq":'mobile-below-question',"clc-tlb":'lb',"clc-mlb":'mlb',"clc-tsb":'sb'}};(function(){var b=x.al;b&&z.push(function(){return a.load()})})(),n(),a.dfp={load:w},a.options=x,a.cmd=z})(this.clc=this.clc||{})}catch(a){window.console.error(a)}</script> <script>
var clc = clc || {};
clc.collapse = { sb: !0, 'tag-sponsorship': !0, lb:!0, mlb:!0, smlb:!0, bmlb:!0, 'mobile-below-question':!0};
clc.options = clc.options || {};
clc.options.sf = !0;
clc.cmd = clc.cmd || [];
clc.cmd.push(function () { window.clc_request='AqdI-ctSHtcIFj5YANkU3AACAAAAAgAAAAMmAAAAfGphdmFzY3JpcHR8anF1ZXJ5fGFqYXh8ZG9jdW1lbnQtYm9keXwAlkjcv-1BX6Fhyg'; clc.load(); });
</script><div class="s-sidebarwidget mb16 module">
<div class="s-sidebarwidget--header grid ai-center">
<a href="https://chat.stackoverflow.com" class="js-chat-ad-link">Visit chat</a>
</div>
<div class="s-sidebarwidget--content s-sidebarwidget__items d-none js-chat-ad-rooms"></div>
</div>
<script>
// <!--
StackExchange.ready(function () {
var options = {
chatUrl: 'https://chat.stackoverflow.com',
reloadUrl: '/api/recent-chat',
preloadedData: null,
tagBased: true,
};
StackExchange.chatAd.init(options);
});
// -->
</script>
<div class="module sidebar-linked">
<h4 id="h-linked">Linked</h4>
<div class="linked" data-tracker="lq=1">
<div class="spacer">
<a href="/q/5404839" title="Vote score (upvotes - downvotes)">
<div class="answer-votes answered-accepted extra-large">2298</div>
</a>
<a href="/questions/5404839/how-can-i-refresh-a-page-with-jquery?noredirect=1" class="question-hyperlink">How can I refresh a page with jQuery?</a>
</div>
<div class="spacer">
<a href="/q/6581803" title="Vote score (upvotes - downvotes)">
<div class="answer-votes answered-accepted default">12</div>
</a>
<a href="/questions/6581803/contentdocument-for-an-iframe?noredirect=1" class="question-hyperlink">contentDocument for an iframe</a>
</div>
<div class="spacer">
<a href="/q/3861325" title="Vote score (upvotes - downvotes)">
<div class="answer-votes answered-accepted default">4</div>
</a>
<a href="/questions/3861325/ajax-get-body-only?noredirect=1" class="question-hyperlink">$.ajax() get body only</a>
</div>
<div class="spacer">
<a href="/q/7839889" title="Vote score (upvotes - downvotes)">
<div class="answer-votes answered-accepted default">4</div>
</a>
<a href="/questions/7839889/trying-to-select-a-body-tag-from-html-that-is-returned-by-get-request?noredirect=1" class="question-hyperlink">Trying to select a 'body' tag from html that is returned by get() request</a>
</div>
<div class="spacer">
<a href="/q/5292592" title="Vote score (upvotes - downvotes)">
<div class="answer-votes answered-accepted default">0</div>
</a>
<a href="/questions/5292592/jquery-load-body-of-page-into-variable?noredirect=1" class="question-hyperlink">jQuery: Load body of page into variable</a>
</div>
<div class="spacer">
<a href="/q/23676967" title="Vote score (upvotes - downvotes)">
<div class="answer-votes answered-accepted default">2</div>
</a>
<a href="/questions/23676967/how-to-select-a-div-from-ajax-response-using-prototype-js?noredirect=1" class="question-hyperlink">How to select a div from Ajax Response using Prototype JS</a>
</div>
<div class="spacer">
<a href="/q/44542474" title="Vote score (upvotes - downvotes)">
<div class="answer-votes answered-accepted default">0</div>
</a>
<a href="/questions/44542474/jquery-find-on-data-from-ajax-call-returns-undefined?noredirect=1" class="question-hyperlink">jQuery .find() on data from .ajax() call returns undefined</a>
</div> </div>
</div>
<div class="module sidebar-related">
<h4 id="h-related">Related</h4>
<div class="related js-gps-related-questions" data-tracker="rq=1">
<div class="spacer"><a href="/q/133310" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted extra-large">1156</div></a><a href="/questions/133310/how-can-i-get-jquery-to-perform-a-synchronous-rather-than-asynchronous-ajax-re" class="question-hyperlink">How can I get jQuery to perform a synchronous, rather than asynchronous, Ajax request?</a></div><div class="spacer"><a href="/q/196684" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted extra-large">1199</div></a><a href="/questions/196684/jquery-get-specific-option-tag-text" class="question-hyperlink">jQuery get specific option tag text</a></div><div class="spacer"><a href="/q/199099" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted extra-large">1289</div></a><a href="/questions/199099/how-to-manage-a-redirect-request-after-a-jquery-ajax-call" class="question-hyperlink">How to manage a redirect request after a jQuery Ajax call</a></div><div class="spacer"><a href="/q/436411" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted extra-large">1353</div></a><a href="/questions/436411/where-should-i-put-script-tags-in-html-markup" class="question-hyperlink">Where should I put <script> tags in HTML markup?</a></div><div class="spacer"><a href="/q/446594" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted extra-large">1757</div></a><a href="/questions/446594/abort-ajax-requests-using-jquery" class="question-hyperlink">Abort Ajax requests using jQuery</a></div><div class="spacer"><a href="/q/1960240" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted large">858</div></a><a href="/questions/1960240/jquery-ajax-submit-form" class="question-hyperlink">jQuery AJAX submit form</a></div><div class="spacer"><a href="/q/2669690" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted extra-large">3878</div></a><a href="/questions/2669690/why-does-google-prepend-while1-to-their-json-responses" class="question-hyperlink">Why does Google prepend while(1); to their JSON responses?</a></div><div class="spacer"><a href="/q/6974684" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted large">450</div></a><a href="/questions/6974684/how-to-send-formdata-objects-with-ajax-requests-in-jquery" class="question-hyperlink">How to send FormData objects with Ajax-requests in jQuery?</a></div><div class="spacer"><a href="/q/12506897" title="Vote score (upvotes - downvotes)"><div class="answer-votes extra-large">1052</div></a><a href="/questions/12506897/is-safari-on-ios-6-caching-ajax-results" class="question-hyperlink">Is Safari on iOS 6 caching $.ajax results?</a></div><div class="spacer"><a href="/q/14220321" title="Vote score (upvotes - downvotes)"><div class="answer-votes answered-accepted extra-large">5054</div></a><a href="/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call" class="question-hyperlink">How do I return the response from an asynchronous call?</a></div>
</div>
</div>
<div id="hot-network-questions" class="module tex2jax_ignore">
<h4>
<a href="https://stackexchange.com/questions?tab=hot"
class="js-gps-track s-link s-link__inherit"
data-gps-track="posts_hot_network.click({ item_type:1, location:11 })">
Hot Network Questions
</a>
</h4>
<ul>
<li >
<div class="favicon favicon-tex" title="TeX - LaTeX Stack Exchange"></div><a href="https://tex.stackexchange.com/questions/503692/how-to-vertically-align-the-three-columns-of-my-table-top-top-middle" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:85 }); posts_hot_network.click({ item_type:2, location:11 })">
How to vertically align the three columns of my table top, top, middle
</a>
</li>
<li >
<div class="favicon favicon-electronics" title="Electrical Engineering Stack Exchange"></div><a href="https://electronics.stackexchange.com/questions/452396/whats-this-thing-in-a-peltier-cooler" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:135 }); posts_hot_network.click({ item_type:2, location:11 })">
What's this thing in a peltier cooler?
</a>
</li>
<li >
<div class="favicon favicon-scifi" title="Science Fiction & Fantasy Stack Exchange"></div><a href="https://scifi.stackexchange.com/questions/217218/how-does-the-fools-guild-make-its-money" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:186 }); posts_hot_network.click({ item_type:2, location:11 })">
How does The Fools Guild make its money?
</a>
</li>
<li >
<div class="favicon favicon-sqa" title="Software Quality Assurance & Testing Stack Exchange"></div><a href="https://sqa.stackexchange.com/questions/40367/is-refreshing-multiple-times-a-test-case-for-web-applications" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:244 }); posts_hot_network.click({ item_type:2, location:11 })">
Is refreshing multiple times a test case for web applications?
</a>
</li>
<li >
<div class="favicon favicon-mathoverflow" title="MathOverflow"></div><a href="https://mathoverflow.net/questions/337942/in-a-topological-space-if-there-exists-a-loop-that-cannot-be-contracted-to-a-poi" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:504 }); posts_hot_network.click({ item_type:2, location:11 })">
In a topological space if there exists a loop that cannot be contracted to a point does there exist a simple loop that cannot be contracted also?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-askubuntu" title="Ask Ubuntu"></div><a href="https://askubuntu.com/questions/1164743/how-to-use-grep-to-search-through-the-help-output" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:89 }); posts_hot_network.click({ item_type:2, location:11 })">
How to use grep to search through the --help output?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-bricks" title="Bricks"></div><a href="https://bricks.stackexchange.com/questions/11538/identification-of-vintage-sloping-window" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:336 }); posts_hot_network.click({ item_type:2, location:11 })">
Identification of vintage sloping window
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-rpg" title="Role-playing Games Stack Exchange"></div><a href="https://rpg.stackexchange.com/questions/153334/what-skills-in-5e-give-trap-knowledge-i-e-the-equivalent-of-dungeoneering-in-4" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:122 }); posts_hot_network.click({ item_type:2, location:11 })">
What skills in 5e give trap knowledge (i.e. the equivalent of Dungeoneering in 4e)?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-gaming" title="Arqade"></div><a href="https://gaming.stackexchange.com/questions/355992/special-tasks-but-no-xp" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:41 }); posts_hot_network.click({ item_type:2, location:11 })">
Special Tasks, but no XP
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-askubuntu" title="Ask Ubuntu"></div><a href="https://askubuntu.com/questions/1164891/how-to-finally-launch-a-vnc-server-on-18-04-without-installing-a-different-deskt" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:89 }); posts_hot_network.click({ item_type:2, location:11 })">
How to finally launch a VNC server on 18.04 without installing a different desktop?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-datascience" title="Data Science Stack Exchange"></div><a href="https://datascience.stackexchange.com/questions/57371/using-random-forest-for-selecting-variables-returns-the-entire-dataframe" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:557 }); posts_hot_network.click({ item_type:2, location:11 })">
Using random forest for selecting variables returns the entire dataframe
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-unix" title="Unix & Linux Stack Exchange"></div><a href="https://unix.stackexchange.com/questions/534881/show-stdout-containing-n-with-line-breaks" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:106 }); posts_hot_network.click({ item_type:2, location:11 })">
Show stdout containing \n with line breaks
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-codegolf" title="Code Golf Stack Exchange"></div><a href="https://codegolf.stackexchange.com/questions/189695/generate-brainfuck-for-the-numbers-1-255" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:200 }); posts_hot_network.click({ item_type:2, location:11 })">
Generate Brainfuck for the numbers 1–255
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-ell" title="English Language Learners Stack Exchange"></div><a href="https://ell.stackexchange.com/questions/220651/what-word-can-be-used-to-describe-a-bug-in-a-movie" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:481 }); posts_hot_network.click({ item_type:2, location:11 })">
What word can be used to describe a bug in a movie?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-crypto" title="Cryptography Stack Exchange"></div><a href="https://crypto.stackexchange.com/questions/72507/why-isn-t-sha-3-in-wider-use" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:281 }); posts_hot_network.click({ item_type:2, location:11 })">
Why isn’t SHA-3 in wider use?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-chess" title="Chess Stack Exchange"></div><a href="https://chess.stackexchange.com/questions/25106/how-many-different-ways-are-there-to-checkmate-in-the-early-game" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:435 }); posts_hot_network.click({ item_type:2, location:11 })">
How many different ways are there to checkmate in the early game?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-rpg" title="Role-playing Games Stack Exchange"></div><a href="https://rpg.stackexchange.com/questions/153304/what-are-the-uses-and-limitations-of-persuasion-insight-and-deception-against" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:122 }); posts_hot_network.click({ item_type:2, location:11 })">
What are the uses and limitations of Persuasion, Insight, and Deception against other PCs?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-softwareengineering" title="Software Engineering Stack Exchange"></div><a href="https://softwareengineering.stackexchange.com/questions/395784/how-do-we-avoid-ci-driven-development" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:131 }); posts_hot_network.click({ item_type:2, location:11 })">
How do we avoid CI-driven development...?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-cooking" title="Seasoned Advice"></div><a href="https://cooking.stackexchange.com/questions/100652/acceptable-to-cut-steak-before-searing" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:49 }); posts_hot_network.click({ item_type:2, location:11 })">
Acceptable to cut steak before searing?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-travel" title="Travel Stack Exchange"></div><a href="https://travel.stackexchange.com/questions/143644/is-it-okay-for-a-ticket-seller-to-grab-a-tip-in-the-usa" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:273 }); posts_hot_network.click({ item_type:2, location:11 })">
Is it okay for a ticket seller to grab a tip in the USA?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-space" title="Space Exploration Stack Exchange"></div><a href="https://space.stackexchange.com/questions/38059/why-were-blood-and-hair-follicles-from-25-people-put-on-the-moon" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:508 }); posts_hot_network.click({ item_type:2, location:11 })">
Why were blood and hair follicles from 25 people put on the Moon?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-ell" title="English Language Learners Stack Exchange"></div><a href="https://ell.stackexchange.com/questions/220749/does-a-code-snippet-compile-or-does-it-get-compiled" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:481 }); posts_hot_network.click({ item_type:2, location:11 })">
Does a code snippet compile? Or does it get compiled?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-ham" title="Amateur Radio Stack Exchange"></div><a href="https://ham.stackexchange.com/questions/15095/why-aren-t-emergency-services-using-callsigns" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:520 }); posts_hot_network.click({ item_type:2, location:11 })">
Why aren’t emergency services using callsigns?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-workplace" title="The Workplace Stack Exchange"></div><a href="https://workplace.stackexchange.com/questions/141964/am-i-overreacting-to-my-team-leaders-unethical-requests" class="js-gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:423 }); posts_hot_network.click({ item_type:2, location:11 })">
Am I overreacting to my team leader's unethical requests?
</a>
</li>
</ul>
<a href="#"
class="show-more js-show-more js-gps-track"
data-gps-track="posts_hot_network.click({ item_type:3, location:11 })">
more hot questions
</a>
</div>
<div id="feed-link" class="js-feed-link">
<a href="/feeds/question/14423257" title="Feed of this question and its answers">
<svg aria-hidden="true" class="svg-icon fc-orange-400 iconRss" width="18" height="18" viewBox="0 0 18 18"><path d="M1 3c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3zm14.5 12C15.5 8.1 9.9 2.5 3 2.5V5a10 10 0 0 1 10 10h2.5zm-5 0A7.5 7.5 0 0 0 3 7.5V10a5 5 0 0 1 5 5h2.5zm-5 0A2.5 2.5 0 0 0 3 12.5V15h2.5z"/></svg>
Question feed
</a>
</div>
<aside class="s-modal js-feed-link-modal" tabindex="-1" role="dialog" aria-labelledby="feed-modal-title" aria-describedby="feed-modal-description" aria-hidden="true">
<div class="s-modal--dialog js-modal-dialog wmx4" role="document" data-controller="se-draggable">
<h1 class="s-modal--header fw-bold js-first-tabbable" id="feed-modal-title" data-target="se-draggable.handle" tabindex="0">
Subscribe to RSS
</h1>
<div class="grid gs4 gsy fd-column">
<div class="grid--cell">
<label class="d-block s-label c-default" for="feed-url">
Question feed
<p class="s-description mt2" id="feed-modal-description">To subscribe to this RSS feed, copy and paste this URL into your RSS reader.</p>
</label>
</div>
<div class="grid ps-relative">
<input class="s-input" type="text" name="feed-url" id="feed-url" readonly="readonly" value="https://stackoverflow.com/feeds/question/14423257" />
<svg aria-hidden="true" class="svg-icon s-input-icon fc-orange-400 iconRss" width="18" height="18" viewBox="0 0 18 18"><path d="M1 3c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3zm14.5 12C15.5 8.1 9.9 2.5 3 2.5V5a10 10 0 0 1 10 10h2.5zm-5 0A7.5 7.5 0 0 0 3 7.5V10a5 5 0 0 1 5 5h2.5zm-5 0A2.5 2.5 0 0 0 3 12.5V15h2.5z"/></svg>
</div>
</div>
<a class="s-modal--close s-btn s-btn__muted js-modal-close js-last-tabbable" href="#" aria-label="Close">
<svg aria-hidden="true" class="svg-icon iconClearSm" width="14" height="14" viewBox="0 0 14 14"><path d="M12 3.41L10.59 2 7 5.59 3.41 2 2 3.41 5.59 7 2 10.59 3.41 12 7 8.41 10.59 12 12 10.59 8.41 7 12 3.41z"/></svg>
</a>
</div>
</aside>
</div>
</div>
<script>StackExchange.ready(function(){$.get('/posts/14423257/ivc/f006');});</script>
<noscript><div><img src="/posts/14423257/ivc/f006" class="dno" alt="" width="0" height="0"></div></noscript><div style="display:none" id="prettify-lang">default</div></div>
<script>
$('#wmd-input').one("keypress", function() {
$.ajax({
url: '/accounts/email-settings-form',
cache: false,
success: function(data) {
$('#submit-button').parent().prepend(data);
}
});
});
</script>
</div>
</div>
<footer id="footer" class="site-footer js-footer" role="contentinfo">
<div class="site-footer--container">
<div class="site-footer--logo">
<a href="https://stackoverflow.com"><svg aria-hidden="true" class="svg-icon native iconLogoGlyphMd" width="32" height="37" viewBox="0 0 32 37"><path d="M26 33v-9h4v13H0V24h4v9h22z" fill="#BCBBBB"/><path d="M21.5 0l-2.7 2 9.9 13.3 2.7-2L21.5 0zM26 18.4L13.3 7.8l2.1-2.5 12.7 10.6-2.1 2.5zM9.1 15.2l15 7 1.4-3-15-7-1.4 3zm14 10.79l.68-2.95-16.1-3.35L7 23l16.1 2.99zM23 30H7v-3h16v3z" fill="#F48024"/></svg></a>
</div>
<nav class="site-footer--nav">
<div class="site-footer--col site-footer--col__visible js-footer-col" data-name="default">
<h5 class="-title"><a href="https://stackoverflow.com" class="js-gps-track" data-gps-track="footer.click({ location: 2, link: 15})">Stack Overflow</a></h5>
<ul class="-list js-primary-footer-links">
<li class="-item"><a href="/questions" class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 16})">Questions</a></li>
<li class="-item"><a href="https://stackoverflow.com/jobs" class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 17})">Jobs</a></li>
<li class="-item"><a href="https://stackoverflow.com/jobs/directory/developer-jobs" class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 11})">Developer Jobs Directory</a></li>
<li class="-item"><a href="https://stackoverflow.com/jobs/salary" class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 28})">Salary Calculator</a></li>
<li class="-item"><a href="/help" class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 3 })">Help</a></li>
<li class="-item"><a onclick='StackExchange.switchMobile("on")' class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 12 })">Mobile</a></li>
</ul>
</div>
<div class="site-footer--col site-footer--col__visible js-footer-col" data-name="default">
<h5 class="-title"><a href="https://www.stackoverflowbusiness.com" class="js-gps-track" data-gps-track="footer.click({ location: 2, link: 19 })">Products</a></h5>
<ul class="-list">
<li class="-item"><a href="https://stackoverflow.com/teams" class="js-gps-track -link"
data-ga="["teams traffic","footer - site nav","stackoverflow.com/teams",null,{"dimension4":"teams"}]"
data-gps-track="footer.click({ location: 2, link: 29 })">Teams</a></li>
<li class="-item"><a href="https://www.stackoverflowbusiness.com/talent" class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 20 })">Talent</a></li>
<li class="-item"><a href="https://www.stackoverflowbusiness.com/advertising" class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 21 })">Advertising</a></li>
<li class="-item"><a href="https://stackoverflow.com/enterprise" class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 22 })">Enterprise</a></li>
</ul>
</div>
<div class="site-footer--col site-footer--col__visible js-footer-col" data-name="default">
<h5 class="-title"><a class="js-gps-track" data-gps-track="footer.click({ location: 2, link: 1 })" href="https://stackoverflow.com/company/about">Company</a></h5>
<ul class="-list">
<li class="-item"><a class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 1 })" href="https://stackoverflow.com/company/about">About</a></li>
<li class="-item"><a class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 27 })" href="https://stackoverflow.com/company/press">Press</a></li>
<li class="-item"><a class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 9 })" href="https://stackoverflow.com/company/work-here">Work Here</a></li>
<li class="-item"><a class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 7 })" href="https://stackoverflow.com/legal">Legal</a></li>
<li class="-item"><a class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 8 })" href="https://stackoverflow.com/legal/privacy-policy">Privacy Policy</a></li>
<li class="-item"><a class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link: 13 })" href="https://stackoverflow.com/company/contact">Contact Us</a></li>
</ul>
</div>
<div class="site-footer--col site-footer--categories-nav site-footer--col__visible">
<a href="#" class="site-footer--back js-footer-back"><svg aria-hidden="true" class="svg-icon iconArrowLeftAlt" width="18" height="18" viewBox="0 0 18 18"><path d="M10.58 16L12 14.59 6.4 9 12 3.41 10.57 2l-7 7 7 7z"/></svg></a>
<div>
<h5 class="-title"><a href="https://stackexchange.com">Stack Exchange<br> Network</a></h5>
<ul class="-list">
<li class="-item"><a href="#" class="-link _expandable js-footer-category-trigger js-gps-track" data-gps-track="footer.click({ location: 2, link: 24 })" data-target="Technology">Technology</a></li>
<li class="-item"><a href="#" class="-link _expandable js-footer-category-trigger js-gps-track" data-gps-track="footer.click({ location: 2, link: 24 })" data-target="Life / Arts">Life / Arts</a></li>
<li class="-item"><a href="#" class="-link _expandable js-footer-category-trigger js-gps-track" data-gps-track="footer.click({ location: 2, link: 24 })" data-target="Culture / Recreation">Culture / Recreation</a></li>
<li class="-item"><a href="#" class="-link _expandable js-footer-category-trigger js-gps-track" data-gps-track="footer.click({ location: 2, link: 24 })" data-target="Science">Science</a></li>
<li class="-item"><a href="#" class="-link _expandable js-footer-category-trigger js-gps-track" data-gps-track="footer.click({ location: 2, link: 24 })" data-target="Other">Other</a></li>
</ul>
</div>
</div>
<div class="site-footer--categories">
<div class="site-footer--col site-footer--category js-footer-col" data-name="Technology">
<ul class="-list">
<li class="-item"><a href="https://stackoverflow.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="professional and enthusiast programmers">Stack Overflow</a></li>
<li class="-item"><a href="https://serverfault.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="system and network administrators">Server Fault</a></li>
<li class="-item"><a href="https://superuser.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="computer enthusiasts and power users">Super User</a></li>
<li class="-item"><a href="https://webapps.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="power users of web applications">Web Applications</a></li>
<li class="-item"><a href="https://askubuntu.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="Ubuntu users and developers">Ask Ubuntu</a></li>
<li class="-item"><a href="https://webmasters.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="pro webmasters">Webmasters</a></li>
<li class="-item"><a href="https://gamedev.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="professional and independent game developers">Game Development</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Technology"><ul class="-list">
<li class="-item"><a href="https://tex.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="users of TeX, LaTeX, ConTeXt, and related typesetting systems">TeX - LaTeX</a></li>
<li class="-item"><a href="https://softwareengineering.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="professionals, academics, and students working within the systems development life cycle">Software Engineering</a></li>
<li class="-item"><a href="https://unix.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="users of Linux, FreeBSD and other Un*x-like operating systems">Unix & Linux</a></li>
<li class="-item"><a href="https://apple.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="power users of Apple hardware and software">Ask Different (Apple)</a></li>
<li class="-item"><a href="https://wordpress.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="WordPress developers and administrators">WordPress Development</a></li>
<li class="-item"><a href="https://gis.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="cartographers, geographers and GIS professionals">Geographic Information Systems</a></li>
<li class="-item"><a href="https://electronics.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="electronics and electrical engineering professionals, students, and enthusiasts">Electrical Engineering</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Technology"><ul class="-list">
<li class="-item"><a href="https://android.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="enthusiasts and power users of the Android operating system">Android Enthusiasts</a></li>
<li class="-item"><a href="https://security.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="information security professionals">Information Security</a></li>
<li class="-item"><a href="https://dba.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="database professionals who wish to improve their database skills and learn from others in the community">Database Administrators</a></li>
<li class="-item"><a href="https://drupal.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="Drupal developers and administrators">Drupal Answers</a></li>
<li class="-item"><a href="https://sharepoint.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="SharePoint enthusiasts">SharePoint</a></li>
<li class="-item"><a href="https://ux.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="user experience researchers and experts">User Experience</a></li>
<li class="-item"><a href="https://mathematica.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="users of Wolfram Mathematica">Mathematica</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Technology"><ul class="-list">
<li class="-item"><a href="https://salesforce.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="Salesforce administrators, implementation experts, developers and anybody in-between">Salesforce</a></li>
<li class="-item"><a href="https://expressionengine.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="administrators, end users, developers and designers for ExpressionEngine® CMS">ExpressionEngine® Answers</a></li>
<li class="-item"><a href="https://pt.stackoverflow.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="programadores profissionais e entusiastas">Stack Overflow em Português</a></li>
<li class="-item"><a href="https://blender.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="people who use Blender to create 3D graphics, animations, or games">Blender</a></li>
<li class="-item"><a href="https://networkengineering.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="network engineers">Network Engineering</a></li>
<li class="-item"><a href="https://crypto.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="software developers, mathematicians and others interested in cryptography">Cryptography</a></li>
<li class="-item"><a href="https://codereview.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="peer programmer code reviews">Code Review</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Technology"><ul class="-list">
<li class="-item"><a href="https://magento.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="users of the Magento e-Commerce platform">Magento</a></li>
<li class="-item"><a href="https://softwarerecs.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="people seeking specific software recommendations">Software Recommendations</a></li>
<li class="-item"><a href="https://dsp.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="practitioners of the art and science of signal, image and video processing">Signal Processing</a></li>
<li class="-item"><a href="https://emacs.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="those using, extending or developing Emacs">Emacs</a></li>
<li class="-item"><a href="https://raspberrypi.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="users and developers of hardware and software for Raspberry Pi">Raspberry Pi</a></li>
<li class="-item"><a href="https://ru.stackoverflow.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="программистов">Stack Overflow на русском</a></li>
<li class="-item"><a href="https://codegolf.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="programming puzzle enthusiasts and code golfers">Code Golf</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Technology"><ul class="-list">
<li class="-item"><a href="https://es.stackoverflow.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="programadores y profesionales de la informática">Stack Overflow en español</a></li>
<li class="-item"><a href="https://ethereum.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="users of Ethereum, the decentralized application platform and smart contract enabled blockchain">Ethereum</a></li>
<li class="-item"><a href="https://datascience.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="Data science professionals, Machine Learning specialists, and those interested in learning more about the field">Data Science</a></li>
<li class="-item"><a href="https://arduino.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="developers of open-source hardware and software that is compatible with Arduino">Arduino</a></li>
<li class="-item"><a href="https://bitcoin.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="Bitcoin crypto-currency enthusiasts">Bitcoin</a></li>
<li class="-item"><a href="https://sqa.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="software quality control experts, automation engineers, and software testers">Software Quality Assurance & Testing</a></li>
<li class="-item"><a href="https://sound.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="sound engineers, producers, editors, and enthusiasts">Sound Design</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Technology"><ul class="-list">
<li class="-item"><a href="https://windowsphone.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="enthusiasts and power users of Windows Phone OS">Windows Phone</a></li>
<li class="-item">
<a href="https://stackexchange.com/sites#technology" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 26 })">
<strong>
more (27)
</strong>
</a>
</li>
</ul>
</div>
<div class="site-footer--col site-footer--category js-footer-col" data-name="Life / Arts">
<ul class="-list">
<li class="-item"><a href="https://photo.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="professional, enthusiast and amateur photographers">Photography</a></li>
<li class="-item"><a href="https://scifi.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="science fiction and fantasy enthusiasts">Science Fiction & Fantasy</a></li>
<li class="-item"><a href="https://graphicdesign.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="Graphic Design professionals, students, and enthusiasts">Graphic Design</a></li>
<li class="-item"><a href="https://movies.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="movie and tv enthusiasts">Movies & TV</a></li>
<li class="-item"><a href="https://music.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="musicians, students, and enthusiasts">Music: Practice & Theory</a></li>
<li class="-item"><a href="https://worldbuilding.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="writers/artists using science, geography and culture to construct imaginary worlds and settings">Worldbuilding</a></li>
<li class="-item"><a href="https://video.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation">Video Production</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Life / Arts"><ul class="-list">
<li class="-item"><a href="https://cooking.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="professional and amateur chefs">Seasoned Advice (cooking)</a></li>
<li class="-item"><a href="https://diy.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="contractors and serious DIYers">Home Improvement</a></li>
<li class="-item"><a href="https://money.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="people who want to be financially literate">Personal Finance & Money</a></li>
<li class="-item"><a href="https://academia.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="academics and those enrolled in higher education">Academia</a></li>
<li class="-item"><a href="https://law.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="legal professionals, students, and others with experience or interest in law">Law</a></li>
<li class="-item"><a href="https://fitness.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="physical fitness professionals, athletes, trainers, and those providing health-related needs">Physical Fitness</a></li>
<li class="-item"><a href="https://gardening.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="gardeners and landscapers">Gardening & Landscaping</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Life / Arts"><ul class="-list">
<li class="-item"><a href="https://parenting.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="parents, grandparents, nannies and others with a parenting role">Parenting</a></li>
<li class="-item">
<a href="https://stackexchange.com/sites#lifearts" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 26 })">
<strong>
more (11)
</strong>
</a>
</li>
</ul>
</div>
<div class="site-footer--col site-footer--category js-footer-col" data-name="Culture / Recreation">
<ul class="-list">
<li class="-item"><a href="https://english.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="linguists, etymologists, and serious English language enthusiasts">English Language & Usage</a></li>
<li class="-item"><a href="https://skeptics.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="scientific skepticism">Skeptics</a></li>
<li class="-item"><a href="https://judaism.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="those who base their lives on Jewish law and tradition and anyone interested in learning more">Mi Yodeya (Judaism)</a></li>
<li class="-item"><a href="https://travel.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="road warriors and seasoned travelers">Travel</a></li>
<li class="-item"><a href="https://christianity.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="committed Christians, experts in Christianity and those interested in learning more">Christianity</a></li>
<li class="-item"><a href="https://ell.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="speakers of other languages learning English">English Language Learners</a></li>
<li class="-item"><a href="https://japanese.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="students, teachers, and linguists wanting to discuss the finer points of the Japanese language">Japanese Language</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Culture / Recreation"><ul class="-list">
<li class="-item"><a href="https://chinese.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="students, teachers, and linguists wanting to discuss the finer points of the Chinese language">Chinese Language</a></li>
<li class="-item"><a href="https://french.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="students, teachers, and linguists wanting to discuss the finer points of the French language">French Language</a></li>
<li class="-item"><a href="https://german.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="speakers of German wanting to discuss the finer points of the language and translation">German Language</a></li>
<li class="-item"><a href="https://hermeneutics.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="professors, theologians, and those interested in exegetical analysis of biblical texts">Biblical Hermeneutics</a></li>
<li class="-item"><a href="https://history.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="historians and history buffs">History</a></li>
<li class="-item"><a href="https://spanish.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="linguists, teachers, students and Spanish language enthusiasts in general wanting to discuss the finer points of the language">Spanish Language</a></li>
<li class="-item"><a href="https://islam.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="Muslims, experts in Islam, and those interested in learning more about Islam">Islam</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Culture / Recreation"><ul class="-list">
<li class="-item"><a href="https://rus.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="лингвистов и энтузиастов русского языка">Русский язык</a></li>
<li class="-item"><a href="https://russian.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="students, teachers, and linguists wanting to discuss the finer points of the Russian language">Russian Language</a></li>
<li class="-item"><a href="https://gaming.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="passionate videogamers on all platforms">Arqade (gaming)</a></li>
<li class="-item"><a href="https://bicycles.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="people who build and repair bicycles, people who train cycling, or commute on bicycles">Bicycles</a></li>
<li class="-item"><a href="https://rpg.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="gamemasters and players of tabletop, paper-and-pencil role-playing games">Role-playing Games</a></li>
<li class="-item"><a href="https://anime.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="anime and manga fans">Anime & Manga</a></li>
<li class="-item"><a href="https://puzzling.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="those who create, solve, and study puzzles">Puzzling</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Culture / Recreation"><ul class="-list">
<li class="-item"><a href="https://mechanics.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="mechanics and DIY enthusiast owners of cars, trucks, and motorcycles">Motor Vehicle Maintenance & Repair</a></li>
<li class="-item"><a href="https://boardgames.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="people who like playing board games, designing board games or modifying the rules of existing board games">Board & Card Games</a></li>
<li class="-item"><a href="https://bricks.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="LEGO® and building block enthusiasts">Bricks</a></li>
<li class="-item"><a href="https://homebrew.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="dedicated home brewers and serious enthusiasts">Homebrewing</a></li>
<li class="-item"><a href="https://martialarts.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="students and teachers of all martial arts">Martial Arts</a></li>
<li class="-item"><a href="https://outdoors.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="people who love being outdoors enjoying nature and wilderness, and learning about the required skills and equipment">The Great Outdoors</a></li>
<li class="-item"><a href="https://poker.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="serious players and enthusiasts of poker">Poker</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Culture / Recreation"><ul class="-list">
<li class="-item"><a href="https://chess.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="serious players and enthusiasts of chess">Chess</a></li>
<li class="-item"><a href="https://sports.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="participants in team and individual sport activities">Sports</a></li>
<li class="-item">
<a href="https://stackexchange.com/sites#culturerecreation" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 26 })">
<strong>
more (16)
</strong>
</a>
</li>
</ul>
</div>
<div class="site-footer--col site-footer--category js-footer-col" data-name="Science">
<ul class="-list">
<li class="-item"><a href="https://mathoverflow.net" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="professional mathematicians">MathOverflow</a></li>
<li class="-item"><a href="https://math.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="people studying math at any level and professionals in related fields">Mathematics</a></li>
<li class="-item"><a href="https://stats.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="people interested in statistics, machine learning, data analysis, data mining, and data visualization">Cross Validated (stats)</a></li>
<li class="-item"><a href="https://cstheory.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="theoretical computer scientists and researchers in related fields">Theoretical Computer Science</a></li>
<li class="-item"><a href="https://physics.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="active researchers, academics and students of physics">Physics</a></li>
<li class="-item"><a href="https://chemistry.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="scientists, academics, teachers, and students in the field of chemistry">Chemistry</a></li>
<li class="-item"><a href="https://biology.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="biology researchers, academics, and students">Biology</a></li>
</ul></div><div class="site-footer--col site-footer--category js-footer-col" data-name="Science"><ul class="-list">
<li class="-item"><a href="https://cs.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="students, researchers and practitioners of computer science">Computer Science</a></li>
<li class="-item"><a href="https://philosophy.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="those interested in the study of the fundamental nature of knowledge, reality, and existence">Philosophy</a></li>
<li class="-item"><a href="https://linguistics.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="professional linguists and others with an interest in linguistic research and theory">Linguistics</a></li>
<li class="-item"><a href="https://psychology.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry">Psychology & Neuroscience</a></li>
<li class="-item"><a href="https://scicomp.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="scientists using computers to solve scientific problems">Computational Science</a></li>
<li class="-item">
<a href="https://stackexchange.com/sites#science" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 26 })">
<strong>
more (8)
</strong>
</a>
</li>
</ul>
</div>
<div class="site-footer--col site-footer--category js-footer-col" data-name="Other">
<ul class="-list">
<li class="-item"><a href="https://meta.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="meta-discussion of the Stack Exchange family of Q&A websites">Meta Stack Exchange</a></li>
<li class="-item"><a href="https://stackapps.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="apps, scripts, and development with the Stack Exchange API">Stack Apps</a></li>
<li class="-item"><a href="https://api.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="programmatic interaction with Stack Exchange sites">API</a></li>
<li class="-item"><a href="https://data.stackexchange.com" class="-link js-gps-track" data-gps-track="footer.click({ location: 16, link: 25 })" title="querying Stack Exchange data using SQL">Data</a></li>
</ul>
</div>
</div>
</nav>
<div class="site-footer--copyright fs-fine">
<ul class="-list">
<li class="-item"><a class="js-gps-track -link" data-gps-track="footer.click({ location: 2, link:4 })" href="https://stackoverflow.blog?blb=1">Blog</a></li>
<li class="-item"><a href="https://www.facebook.com/officialstackoverflow/" class="-link">Facebook</a></li>
<li class="-item"><a href="https://twitter.com/stackoverflow" class="-link">Twitter</a></li>
<li class="-item"><a href="https://linkedin.com/company/stack-overflow" class="-link">LinkedIn</a></li>
</ul>
<p class="mt-auto mb24">
site design / logo © 2019 Stack Exchange Inc; user contributions licensed under <a href="https://creativecommons.org/licenses/by-sa/3.0/" rel="license">cc by-sa 3.0</a>
with <a href="https://stackoverflow.blog/2009/06/25/attribution-required/" rel="license">attribution required</a>.
<span id="svnrev">rev 2019.8.9.34569</span>
</p>
</div>
</div>
</footer>
<script>StackExchange.ready(function () { StackExchange.responsiveness.addSwitcher(); })</script>
<noscript>
<div id="noscript-warning">Stack Overflow works best with JavaScript enabled
</div>
</noscript>
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function() { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
StackExchange.ready(function () {
StackExchange.ga.init({
sendTitles: true,
tracker: window.ga,
trackingCodes: [
'UA-108242619-1'
]
});
StackExchange.ga.setDimension('dimension1', '5783062');
StackExchange.ga.setDimension('dimension2', '|javascript|jquery|ajax|document-body|');
StackExchange.ga.setDimension('dimension3', 'Questions/Show');
StackExchange.ga.trackPageView();
});
/**/
var _qevents = _qevents || [],
_comscore = _comscore || [];
(function() {
var ssl = 'https:' == document.location.protocol,
s = document.getElementsByTagName('script')[0],
qc = document.createElement('script');
qc.async = true;
qc.src = (ssl ? 'https://secure' : 'http://edge') + '.quantserve.com/quant.js';
s.parentNode.insertBefore(qc, s);
_qevents.push({ qacct: "p-c1rF4kxgLUzNc" });
/**/
var sc = document.createElement('script');
sc.async = true;
sc.src = (ssl ? 'https://sb' : 'http://b') + '.scorecardresearch.com/beacon.js';
s.parentNode.insertBefore(sc, s);
_comscore.push({ c1: "2", c2: "17440561" });
})();
</script>
</body>
</html>
`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/