Ho un jQuery ajax get che restituirà un testo html. Da questo ho bisogno di estrarre il valore dell'elemento h3 (con id = 'titolo'): THIS IS TITLE
.jQuery analizza i dati di risposta ajax e ottiene l'id dell'elemento - value
Posso raggiungere questo obiettivo con jQuery?
<div class="content">
<h3 id="title">THIS IS TITLE</h3>
.....
</div>
e qui è la chiamata:
$.ajax({
url: url,
type: 'GET',
cache:false,
success: function (data) { // data is the html text returned
alert('The title is: ' + TITLE HERE);
}
});
Forse usando trova, credo? –
'$ (data) .find ('# title'). Text()' – undefined
Poiché Id è univoco, puoi usare $ ('# title'). Text() –