I'm trying to get some data from a website using ajax.
This is my code with an ajax POST methode:
$(data).find('.col-md-9 .panel:lt(5)').each(function () { console.log($(this).find('.panel-body .sp-card td:eq(1) center ').text());
console:
Mc-Wars Network IP: mc-wars.org Vote - Server info Website
I just want to get the first line : Mc-Wars Network
Please help!
Here is an image of the html code Im scraping.
Here is an image of the console after scraping. (I just need the first line.
This is code from the website Im scraping:
<div onclick="location.href='//www.serverpact.com/vote-20129 ';" class="panel panel-default sp-plane">
<div class="ribbon ribbon-small ribbon-blue">
<div class="banner">
<div style="font-size: 14px;text-align: center;" class="text">#1</div>
</div>
</div>
<div style="padding: 5px;" class="panel-body">
<table class="sp-card">
<tbody><tr>
<td style="font-weight: bold;vertical-align: middle;"><center><i class="fa fa-thumbs-up"></i><br>8384<br><br>#1</center></td>
<td style="font-weight: bold;vertical-align: middle;">
<center>
Mc-Wars Network<br>
<b>IP: mc-wars.org<br>
<a style="margin-top: 5px;" class="btn btn-primary btn-sm" href="//www.serverpact.com/vote-20129 ">Vote - Server info</a>
<a style="margin-top: 5px;" class="btn btn-success btn-sm" href="http://mc-wars.org">Website</a>
</b></center>
</td>
<td width="500px" class="hidden-xs">
<a href="http://mc-wars.org" target="_blank"><img style="margin-top: 7px;margin-bottom: 3px;border-radius: 4px;" src="http://www.serverpact.com/b/20129.gif" alt="Mc-Wars Network" class="img-responsive hidden-xs"></a>
<span style="font-size: 13px;">
McWars is a minecraft pvp based server where you will have to build a fortress for your team and destroy the other teams base to win. With more than 10 different classes to choose, youll love it.
</span>
</td>
</tr>
</tbody></table>
</div>
</div>