I am fetching 2 div’s from a page using $.post jQuery AJAX request. Now the data that comes after the execution is from a POST request and is something like this…
//data.php
<div id="alpha">alpha</div><div id="beta">beta</div>
Now if i want to load the data of just the div with id ‘alpha’ into a div with id ‘container’ in the present page and if the data came by a GET request my life would be easier…
$("#container").load('data.php #alpha');
would solve the problem.
I want to do similar filtering on success function using $.post function in jQuery so i can load the appropriate div’s at the appropriate page in the current page. How can i achieve this?
$.post('data.php',null,function(data){
//what to do here?
});
Thanks
If the response is exactly as you describe and does not have a root element.
Example on jsfiddle