[jQuery] How do I extract a part of received data
I explain...
I try to load only a part of my data file (named Elements.html).
It will load all the data file with
var elem = $('#section_news', data);
I am unable to load only a section of this file if I use
var elem = $('#section_news', data);
Could you please help me find out what part of my code is incorrect?
Thanks
Here is my code
$.get("Elements.html", function(data){
// get id section_news for the receive data
var elem = $('#section_news', data);
$('#content').empty().append(elem);
});
My host html
<body>
<div id="content"></div>
</body>
My Elements.html data file
<p id="section_news">Hello World!<p id="section_home">Hello Fred!</
p>