JQERY newbie ?
JQERY newbie ?
I'm using the following code to override a link's onClick event. I want to load the link's href into my div.
-
1. function handleLoading(data) {
2. var $content = $("<div></div>").html(data);
3. var $visualBadge = $("#visualBadge");
4.
5. $visualBadge.children("div").replaceWith($content);
6. $visualBadge.find("a").click(handleClick);
7. }
8.
9. function handleClick(evt) {
10. var link = this;
11. var path = link.href;
12. if(path.indexOf("#") != (path.length-1)){
13. alert(path);
14. $.get(link.href, handleLoading);
15. evt.preventDefault();
16. return false;
17. }
18. }
It works great in Firefox 3.5. But, in IE7 it hits the return false before the $.get completes, and causes the $.get to stop prematurely.
I need the $.get to be able to complete and still be able to prevent the link's default event.
Any suggestions? This is the 3rd forum I'm trying. I really need help![/code]