[jQuery] Re: .get, callback function and scope. Is this possible?

2007-06-23 Thread Andy Matthews
Mike... The reason I was moving in that direction was that I needed the results of the $,get call immediately after it ran. I was using in conjunction with jEditable as a function call and I had to return the string that $.get got back from the server to jEditable. Sadly, I'm going to have to pu

[jQuery] Re: .get, callback function and scope. Is this possible?

2007-06-23 Thread Rey Bango
No offense taken Mike. Andy and I were pounding our heads trying to figure out why the value wasn't appearing so by using the synchronous call, I was able to figure out that the variable outside of the $.get() callback was indeed being filled. You're right, though, that a synchronous call sh

[jQuery] Re: .get, callback function and scope. Is this possible?

2007-06-22 Thread Michael Geary
Rey, no offense, bud, but synchronous ajax is a last resort. It freezes the browser while the ajax data is loaded. You don't want to use it unless you're certain that it's necessary - and that is rare. Andy, the real question is what you want to do. Scope is not a problem: You can easily assign

[jQuery] Re: .get, callback function and scope. Is this possible?

2007-06-22 Thread Rey Bango
Hey Andy, I found out what's happening. You are in fact updating the var but $.get() being an async method, will take longer to complete than the rest of the JS script. Here's a small example: $(document).ready(function() { foo = 'test 1'; $.get("module.cfm", function(resu

[jQuery] Re: .get, callback function and scope. Is this possible?

2007-06-22 Thread Rey Bango
Andy, I kept at it and I found this: $(document).ready(function() { foo = 'test 1'; foo = $.ajax({ url: "module.cfm", async: false }).responseText; alert( foo ); }); It worked for me by setting the value of foo from the actu