Is it possible to abort() a jQuery load()?
-
I'm using load() to get page fragments and the XMLHttpRequest object doesn't seem to be available until the callback (which is too late, obviously). Conversely, is there a way to load a page fragment (via jQuery selector) using $.get()?
-
Answer:
Yes, $.get() will do the trick. The browser's innerHTML parses the html response of such a call, so you just need to shove the response into a dummy DOM node. This is precisely the implementation of .load(). So you need your $.get() callback to do something like: function(resHTML) { $('#target').html( $("<div />") .html( resHTML.replace(/<script(.|\s)*?\/script>/gi, "") ) .find("#content") ); }
Evan Q Jones at Quora Visit the source
Related Q & A:
- Is it possible to allow a client/user to log into a Remote Desktop session using credentials other than their AD username/password? (for SSO?Best solution by Server Fault
- How to open a partial view from controller as a Jquery Mobile dialog?Best solution by Stack Overflow
- How to fire a function before and after automatically in a jquery plugin?Best solution by catchmyfame.com
- Is it possible to use a phone camera as a webcam?Best solution by Yahoo! Answers
- Is it possible to use a game controller as a mouse?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.