I want to GET html from my second site(subdomain) and use it to build a part of this site.
HTML site:
<head>
<body>
<div id = "items">
<div id = "#one">
<ul>
<li><a href = "#">Click here</a></li>
<li><img src = "/images.png" /></li>
</ul>
</div>
<div id = "#two">
<ul>
<li><a href = "#">Click here</a></li>
<li><img src = "/images2.png" /></li>
</ul>
</div>
</div>
</body>
</head>
I want to do things like counting number of div elements, getting list etc.
This is what I tried:
$.ajax({
url: '/mysite/items.html',
success: function(data) {
//Need to manipulate here
var html = $(data);
var items = $.get(".items", html);
var numItems = $('.items').length;
console.log(data); //There is data(Whole HTML is here.)
console.log(items); //This is undefined??
console.log(numItems): //This is undefined??
var raw = html.get(".offers"); //Complains doesnot have a get method??
},
});