I was until recently using $.load()
to get a specific piece of another page and load it into the current one, but as the user initiates those requests they can queue up and I found myself needing a way to abort them lest click-happy users break my page.
This led me to $.get()
which works great and lets me abort the request if another is launched before the first returns, but now I need to parse the returned html (it's an entire page with doc-type and head elements) and only get one div from it.
How do I achieve this?
This should work:
$.get('ajax/test.html', function(data) {
var my_div = $('#my_div', $(data));
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With