How to read html with jQuery in data in jQuery get method $.get -
in jquery statement:
$.get(someurl, function (data) { ### });
i receiving like:
<div class="somediv">john smith</div>
question is: how jquery read data html $("div.somediv").text() in function response ### placed?
i need read div text through div class name, because can have multiple divs different class names
if data == '<div class="somediv">john smith</div>'
then should work
$(data).text()
if data has bunch of other html can filter after making jquery object
var text = $(data).filter('div.somediv').text();
if need selection later on, can add body this
var $data = $(data) $data.length && $(body).append($data.css('display','none'));
and later select
$('div.somediv').text()
Comments
Post a Comment