[jQuery] Assigning $() function directly to a variable
<html><head><style type="text/css"><!-- DIV {margin:0px} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt">Hello Everyone,
I just joined the discussion yesterday, and I've only recently started using Jquery, it's actually the first javascript library I've used, and so far I really like it.
I have been reading the documentation and API, and so far I have not been able to figure out the solution to my problem, although I would figure it should be an easy problem to fix.
What I want to do, is assign an AJAX URL response to a variable. Such as, I'd like to accomplish something like the following:
var myvar;
$(myvar).load("/test_ajax");
alert(myvar);
That's a rough example, and I've only been able to accomplish the idea with writing to a DIV tag, like:
$("#varholder").load("/test_ajax",function() {
var textload = $("#varholder").text();
alert("textload= '" + textload + "'");
});
Where #varholder is an ID of a div tag, and I understand I could have that div tag hidden with CSS so it's invisible to the user, but it still seems like it'd be greater overhead to have to write to the DOM, and *then* apply it to a variable. (Basically what it comes down to is that there is a bunch of functions that I want to do with that variable, instead of loading it straght-up to the DOM).
So, is there a way to write the value directly to a variable and bypass writing to the DIV tag?
Okay, well thanks for any help :)
-Dave Kedron
</div></body></html>_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/