5
我有一個jQuery ajax get,它將返回一個html文本。從這一個我需要提取h3元素(ID ='標題')值:THIS IS TITLE
。jQuery解析ajax響應數據並獲取元素id - 值
我可以用jQuery來實現嗎?
<div class="content">
<h3 id="title">THIS IS TITLE</h3>
.....
</div>
,這裏是電話:
$.ajax({
url: url,
type: 'GET',
cache:false,
success: function (data) { // data is the html text returned
alert('The title is: ' + TITLE HERE);
}
});
也許使用find我猜? –
'$(data).find('#title')。text()' – undefined
由於Id是唯一的,所以可以使用$('#title').text() –