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

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -