我正在研究jQuery。我从jQuery返回了一个页面,它返回以下html代码。
我想找到id <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />
<meta name="generator" content="WordPress 4.2.2"/>
<title>Planner | Test</title>
<link rel="shortcut icon" href="http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/images/fevicon.icon">
<link rel="stylesheet" href="http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/style.css" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="Test » Planner Comments Feed" href="http://localhost/wordpress/planner/feed/" />
<script type="text/javascript">
window._wpemojiSettings = {"baseUrl":"http:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/localhost\/wordpress\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.2.2"}};
!function(a,b,c){function d(a){var c=b.createElement("canvas"),d=c.getContext&&c.getContext("2d");return d&&d.fillText?(d.textBaseline="top",d.font="600 32px Arial","flag"===a?(d.fillText(String.fromCharCode(55356,56812,55356,56807),0,0),c.toDataURL().length>3e3):(d.fillText(String.fromCharCode(55357,56835),0,0),0!==d.getImageData(16,16,1,1).data[0])):!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g;c.supports={simple:d("simple"),flag:d("flag")},c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.simple&&c.supports.flag||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
</script>
<style type="text/css">
img.wp-smiley,
img.emoji {
display: inline !important;
border: none !important;
box-shadow: none !important;
height: 1em !important;
width: 1em !important;
margin: 0 .07em !important;
vertical-align: -0.1em !important;
background: none !important;
padding: 0 !important;
}
</style>
<link rel='stylesheet' id='open-sans-css' href='//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='dashicons-css' href='http://localhost/wordpress/wp-includes/css/dashicons.min.css?ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='admin-bar-css' href='http://localhost/wordpress/wp-includes/css/admin-bar.min.css?ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='woocommerce-layout-css' href='//localhost/wordpress/wp-content/plugins/woocommerce/assets/css/woocommerce-layout.css?ver=2.3.11' type='text/css' media='all' />
<link rel='stylesheet' id='woocommerce-smallscreen-css' href='//localhost/wordpress/wp-content/plugins/woocommerce/assets/css/woocommerce-smallscreen.css?ver=2.3.11' type='text/css' media='only screen and (max-width: 768px)' />
<link rel='stylesheet' id='woocommerce-general-css' href='//localhost/wordpress/wp-content/plugins/woocommerce/assets/css/woocommerce.css?ver=2.3.11' type='text/css' media='all' />
<link rel='stylesheet' id='font-awesome-css' href='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/font-awesome-4.0.0/css/font-awesome.css?ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='responsive-tabs-css' href='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/css/responsive-tabs.css?ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='bootstrap-css' href='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/css/bootstrap.css?ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='bootstrap-min-css' href='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/css/bootstrap.min.css?ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='bootstrap-responsive-css' href='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/css/bootstrap-responsive.css?ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='font-css' href='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/css/font/font.css?ver=4.2.2' type='text/css' media='all' />
<link rel='stylesheet' id='flex_css-css' href='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/css/flex_css/flexslider.css?ver=4.2.2' type='text/css' media='all' />
<script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/jquery/jquery.js?ver=1.11.2'></script>
<script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var MyAjax = {"ajaxurl":"http:\/\/localhost\/wordpress\/wp-admin\/admin-ajax.php"};
/* ]]> */
</script>
<script type='text/javascript' src='http://localhost/wordpress/wp-content/plugins/woocommerce-check-pincode-zipcode-for-shipping//assets/js/custom.js?ver=4.2.2'></script>
<script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/js/menu/bootstrap.min.js?ver=4.2.2'></script>
<script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/js/menu/menu.js?ver=4.2.2'></script>
<script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/js/menu/jquery.scrollTo.min.js?ver=4.2.2'></script>
<script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/js/flex_slider/jquery.flexslider.js?ver=4.2.2'></script>
<script type='text/javascript' src='http://localhost/wordpress/wp-content/themes/Tiffin_Mngnt/js/webriti-tab-js.js?ver=4.2.2'></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/wordpress/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/wordpress/wp-includes/wlwmanifest.xml" />
<meta name="generator" content="WordPress 4.2.2" />
<meta name="generator" content="WooCommerce 2.3.11" />
<link rel='canonical' href='http://localhost/wordpress/planner/' />
<link rel='shortlink' href='http://localhost/wordpress/?p=50' />
<script>
var blog_title = 'http://localhost/wordpress/wp-content/plugins/woocommerce-check-pincode-zipcode-for-shipping/';
var usejs = 0;
</script>
<link rel="stylesheet" href="http://localhost/wordpress/wp-content/plugins/woocommerce-check-pincode-zipcode-for-shipping//assets/css/style.css"> <style>
#shade{background: none repeat scroll 0 0 #000000;opacity: 0.5;}
#shade {height: 100%;left: 0;position: fixed;top: 0;width: 100%;z-index: 100;}
form.cart #my_custom_checkout_field #pincode_field_id{width:180px;border: 1px solid #d3d3d3;margin-right: 5px;font-size: 13px;font-family: "Source Sans Pro",Helvetica,sans-serif;}
form.cart #my_custom_checkout_field #pincode_field_idp label{display: inline-block;margin-right: 5px;font-size: 14px;font-family: "Source Sans Pro",Helvetica,sans-serif;color:#737070;}
form.cart .wc-delivery-time-response .delivery-info-wrap {margin: 15px 0;}
form.cart .wc-delivery-time-response .delivery-info-wrap .delivery-info {display: inline-block;width: 100%; position: relative;}
form.cart .wc-delivery-time-response .delivery-info-wrap .delivery-info .header {float: left;width: 50%;}
form.cart .wc-delivery-time-response .delivery-info-wrap .delivery-info .cash-on-delivery-info-wrap {float: right;width: 50%;position:relative;}
form.cart .wc-delivery-time-response .delivery-info-wrap .delivery-info .delivery-help-icon{margin-left:5px;cursor:pointer;}
form.cart .wc-delivery-time-response .delivery-info-wrap .delivery-info .header .delivery .ul-disc{margin:0;padding:0;list-style:none;}
form.cart .wc-delivery-time-response .delivery-info-wrap .delivery-info .cash-on-delivery-info-wrap .cash-on-delivery-info .header{float:none;width:100%;}
form.cart .wc-delivery-time-response .delivery-info-wrap .delivery-info .cash-on-delivery-info-wrap .cash-on-delivery-info .header .cash-on-delivery-help-icon{margin-left: 5px;cursor:pointer;}
/*-------------------product1-----------------*/
#my_custom_checkout_field2 #pincode_field_idp #pincode_field_id.input-text{width:180px;border: 1px solid #666666;margin-right: 5px;font-size: 13px;font-family: "Source Sans Pro",Helvetica,sans-serif;color:#999;}
#my_custom_checkout_field2 #pincode_field_idp .button{ margin-top:-3px;padding:5px 10px;float: none;font-size: 14px;font-family: "Source Sans Pro",Helvetica,sans-serif;text-transform: uppercase; font-weight: normal;}
#my_custom_checkout_field #pincode_field_idp #pincode_field_id.input-text{width:180px;border: 1px solid #666666;margin-right: 5px;font-size: 13px;font-family: "Source Sans Pro",Helvetica,sans-serif;}
#my_custom_checkout_field #pincode_field_idp .button{ margin-top:-3px;padding: 5px 10px;float: none;font-size: 14px;font-family: "Source Sans Pro",Helvetica,sans-serif;text-transform: uppercase; font-weight: normal;}
.delivery_help_text p{font-size: 14px;font-family: "Source Sans Pro",Helvetica,sans-serif;color:#737070;}
.delivery_help_text h3{font-size: 16px;font-family: "Source Sans Pro",Helvetica,sans-serif;color:#7d7b6d;}
.header .cash_on_delivery_help_text p{font-size: 14px;font-family: "Source Sans Pro",Helvetica,sans-serif;color:#737070;}
.header .cash_on_delivery_help_text h3{font-size: 16px;font-family: "Source Sans Pro",Helvetica,sans-serif;color:#7d7b6d;}
.delivery-help-cross {color: #000 !important;font-size: 17px;font-weight: bold;position: absolute;right: 0px;top: -2px;cursor: pointer;}
/*-------------------product1-----------------*/
.cash_on_delivery_help_text p{font-size: 14px;font-family: "Source Sans Pro",Helvetica,sans-serif;color:#737070;}
/*------------background & border color & EOD message color------------*/
.avlpin{ background:#f4f2f2; }
.avlpin{ border: 1px solid #e8e7e7; }
.avlpin{ margin:24px 0 12px; padding:20px; text-align:center; min-width:400px; display:inline-block;box-sizing:border-box;}
.pin_div{ background:#f4f2f2; }
.pin_div{ border: 1px solid #e8e7e7; }
.pin_div{ margin:24px 0 12px; padding:20px; text-align:center; width:100%; display:inline-block; }
/*------------background & border color & EOD message color------------*/
/*------------Text color------------*/
.avlpin p{ color:#737070; }
.avlpin p{ display:inline-block; margin-right: 5px; font-size: 14px; font-family: "Source Sans Pro",Helvetica,sans-serif; margin-bottom:0;}
#pincode_field_idp label{color:#737070; display: inline-block; margin-right: 5px; font-size:14px; font-family: "Source Sans Pro",Helvetica,sans-serif;}
/*------------Text color------------*/
/*------------Button & Button Text color------------*/
#change_pin.button{ background:#a46497; }
#change_pin.button{ color:#ffffff; }
#my_custom_checkout_field2 #pincode_field_idp .button{ color:#ffffff; }
#my_custom_checkout_field2 #pincode_field_idp .button{ background:none repeat scroll 0 0 #a46497; }
#my_custom_checkout_field #pincode_field_idp .button{ color:#ffffff; }
#my_custom_checkout_field #pincode_field_idp .button{ background:none repeat scroll 0 0 #a46497; }
#change_pin.button{ float:none; font-size: 14px; font-family: "Source Sans Pro",Helvetica,sans-serif; padding:7px 12px; text-transform: uppercase; font-weight:normal;}
/*------------Button & Button Text color------------*/
/*-----Tooltip Border, Tooltip Background & Tooltip Text color-----*/
.header .delivery_help_text{ background:#EDEDED; }
.header .delivery_help_text{ border:1px solid #e8e7e7; }
.header .delivery_help_text{ width:100%; box-sizing: border-box; overflow:auto; height:200px; position: absolute; z-index:9999; top:25px; left:0; padding:15px; font-size:14px; font-family: "Source Sans Pro",Helvetica,sans-serif;}
/*-----Tooltip Border, Tooltip Background & Tooltip Text color-----*/
/*------------Delivered by Text color------------*/
.delivery-info h6{ margin:0; display:inline-block; font-size: 16px; font-family: "Source Sans Pro",Helvetica,sans-serif;}
/*------------Delivered by Text color------------*/
/*------------Date color------------*/
.delivery .ul-disc li{ font-size:14px;font-family: "Source Sans Pro",Helvetica,sans-serif;}
/*------------Date color------------*/
.delivery_help_text_main{ position: relative;width:100%; }
.delivery-info span h6{ color:#484747; }
.width_class { }
</style>
<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
<style type="text/css" media="screen">
html { margin-top: 32px !important; }
* html body { margin-top: 32px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 46px !important; }
* html body { margin-top: 46px !important; }
}
</style>
</head>
<body class="page page-id-50 page-template page-template-calendar page-template-calendar-php logged-in admin-bar no-customize-support" >
<!-- Navigation -->
Welcome, registered userakhilesh! <nav class="navbar remove-nav-bg navbar-fixed-top topnav" role="navigation">
<div class="container topnav">
<div class="navbar-header ">
<!-- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button> -->
<div class="logoarea">
<a class=" topnav" href="#"><h1>TiffinKaku</h1></a>
</div>
</div>
<div class="main_mm">
<ul>
<li><a href="#">Menu</a></li>
<li ><a href="#" class="selected">Planner</a></li>
<li><a href="#">Shopping List</a></li>
</ul>
</div>
<div class="right_cl">
<div class="right_menu">
<ul>
<li>Hi, Dada </li>
<li><a href="#">Account</a></li>
<li><a href="#">Help</a></li>
<li class="bordernw"><a href="#">Logout</a></li>
</ul>
</div>
<div class="main_mm_co">
<ul>
<li><a href="#">Check Out</a></li>
</ul>
</div>
</div>
</div>
</nav>
<!-- Header --> <script>
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultDate: '2015-06-16',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
{
id : '7',
title : 'Fruits +',
start : '2015-06-16',
},
{
id : '8',
title : 'Snacks +',
start : '2015-06-16',
},
],
eventClick: function(calEvent, jsEvent, view) {
alert(calEvent.id);
var currenturl = jQuery(location).attr('href');
var FirstData = "ServiceId=" + calEvent.id;
var url = currenturl;
jQuery.ajax({
dataType : 'html',
type: 'GET',
url : url,
data : FirstData,
complete : function() { },
success: function(data)
{
//data=jQuery(data).find('div#stfflistdiv');
console.log(data);
var success = $($.parseHTML(data)).filter("#stfflistdiv");
console.log(success.textContent); // div#success
jQuery('#staff').show();
jQuery('#staff').html(data);
jQuery('#sheduling_wait').hide();
jQuery('#show_result').show();
}
});
}
});
});
</script>
<!-- Container -->
<section>
<div class="container-fluid">
<div class="row topposition">
<div class="col-md-4">
<div class="menuitem shadow_cs"><h3>Add Menu Items</h3></div>
<div class="menuitemsub"><h4>Salad Menu</h4><span style="color:#0093cf;font-size:10px;">*available between 12PM to 6 PM</span></div>
<div class="main_fditem shadow_cs">
<div class="food_menu">
<img src="img/image1.jpg" alt="image">
<div class="heading_food">
<p class="food_head">Dummy Heading</p>
<p class="food_head1">Description 1</p>
<p class="food_head1">Description 2</p>
</div>
<div class="price">400</div>
<div class="qty">
<label for="user_lic">QNTY </label>
<input id="user_lic" type="number" min="0" max="10" step="1" value ="0"/>
</div>
</div>
<div class="food_menu">
<img src="img/image1.jpg" alt="image">
<div class="heading_food">
<p class="food_head">Dummy Heading</p>
<p class="food_head1">Description 1</p>
<p class="food_head1">Description 2</p>
</div>
<div class="price">400</div>
<div class="qty">
<label for="user_lic">QNTY </label>
<input id="user_lic" type="number" min="0" max="10" step="1" value ="0"/>
</div>
</div>
<div class="food_menu">
<img src="img/image1.jpg" alt="image">
<div class="heading_food">
<p class="food_head">Dummy Heading</p>
<p class="food_head1">Description 1</p>
<p class="food_head1">Description 2</p>
</div>
<div class="price">400</div>
<div class="qty">
<label for="user_lic">QNTY </label>
<input id="user_lic" type="number" min="0" max="10" step="1" value ="0"/>
</div>
</div>
<div class="food_menu">
<img src="img/image1.jpg" alt="image">
<div class="heading_food">
<p class="food_head">Dummy Heading</p>
<p class="food_head1">Description 1</p>
<p class="food_head1">Description 2</p>
</div>
<div class="price">400</div>
<div class="qty">
<label for="user_lic">QNTY </label>
<input id="user_lic" type="number" min="0" max="10" step="1" value ="0"/>
</div>
</div>
<div class="food_menu">
<img src="img/image1.jpg" alt="image">
<div class="heading_food">
<p class="food_head">Dummy Heading</p>
<p class="food_head1">Description 1</p>
<p class="food_head1">Description 2</p>
</div>
<div class="price">400</div>
<div class="qty">
<label for="user_lic">QNTY </label>
<input id="user_lic" type="number" min="0" max="10" step="1" value ="0"/>
</div>
</div>
<div class="food_menu">
<img src="img/image1.jpg" alt="image">
<div class="heading_food">
<p class="food_head">Dummy Heading</p>
<p class="food_head1">Description 1</p>
<p class="food_head1">Description 2</p>
</div>
<div class="price">400</div>
<div class="qty">
<label for="user_lic">QNTY </label>
<input id="user_lic" type="number" min="0" max="10" step="1" value ="0"/>
</div>
</div>
<div class="food_menu">
<img src="img/image1.jpg" alt="image">
<div class="heading_food">
<p class="food_head">Dummy Heading</p>
<p class="food_head1">Description 1</p>
<p class="food_head1">Description 2</p>
</div>
<div class="price">400</div>
<div class="qty">
<label for="user_lic">QNTY </label>
<input id="user_lic" type="number" min="0" max="10" step="1" value ="0"/>
</div>
</div>
</div>
</div>
<div class="col-md-8">
<div id='calendar'></div>
</div>
</div>
</div>
</section>
<div id="stfflistdiv">
hello </div>
<!-- /Container -->
data=jQuery(data).find('div#stfflistdiv');
console.log(data);
我尝试过以下代码:
var success = $($.parseHTML(data)).filter("#stfflistdiv");
console.log(success.textContent);
和
(XMLUni::fgDOMElementContentWhitespace,false)
但是没有代码正常工作,我无法显示div的html