[jQuery] Re: Variable Scope Help

2009-08-27 Thread James
Oh, the reason I used a function instead of: extraParams: {catID:categoryID}, is because the function acts as a callback that will execute right before the AJAX call to get the updated data for categoryID, otherwise it will just be the same as the URL, set only on initialization (which is blank).

[jQuery] Re: Variable Scope Help

2009-08-27 Thread James
It's not really a variable scope problem. You're misunderstanding when variables are set. This is what's happening: set global variable categoryID add change event add autocomplete with URL set to aloha/item_search/"+categoryID -> categoryID is blank do rest of page When you do your change e

[jQuery] Re: Variable Scope Help

2009-08-27 Thread James
I haven't tested this, nor tried it before, but based on the documentation the data type of extraParams has to be an object, or a function (that probably returns an object). function getCategoryID() { return {catID:categoryID}; // 'catID' will be the name of the categoryID in your script

[jQuery] Re: Variable Scope Help

2009-08-27 Thread WhoButSB
Thank you James for the help! I didn't know that the address is static once you've initialized it. I'm trying to work with the extraParams option but it doesn't seem to do anything. Here is how I have it set: //Item Search for food name $("#add-item #ITEMNAME").autocomplete("", {

[jQuery] Re: variable scope

2009-08-23 Thread Michael Geary
In this line of code: > $('.menu_button').click(this.onClick); you are getting a refernece to your onClick function. But that's all you get - a *function* reference. It doesn't remember that you said 'this.onClick' to get that reference. As you found, when that function gets called later by jQu

[jQuery] Re: Variable scope trouble

2009-07-19 Thread rhodopsin
Thank you Mike! It works perfect now.

[jQuery] Re: Variable scope trouble

2009-07-18 Thread Michael Geary
The problem is the use of 'this' in the inner function. In that code it no longer means what you want it to mean. Try this (pun intended) instead: $('a[href^=logmar]').queue(function(){ var $this = $(this); var args = $this.attr("href").split('?')[1]; if(args.charAt(0) ==

[jQuery] Re: Variable scope trouble

2009-07-18 Thread rhodopsin
After getting a good nights sleep, and doing more research, it seems the problem is not scope-related, but ajax-related. The advice I have read suggests setting return values from within the ajax callback function, because of the asynchronous completion of the ajax function. So, I have attempted t

[jQuery] Re: Variable scope

2009-06-28 Thread Charlie
if check_user_auth is a file it doesn't have an extension for url DanielMedia wrote: Hi, I'm pretty new to jQuery. I'm having a problem with variable scope. This function always returns false. The success variable is not being changed within the getJSON function. I'd appreciate any help.

[jQuery] Re: Variable scope

2009-06-28 Thread Scott Sauyet
DanielMedia wrote: This function always returns false. The success variable is not being changed within the getJSON function. I'd appreciate any help. Thanks. var check_user = function() { var success = false; $.getJSON(url, function(response) { if(resp

[jQuery] Re: Variable scope

2009-06-28 Thread DanielMedia
Hoping someone can help me out with this. I'd appreciate any help.

[jQuery] Re: variable scope bug in Firefox only?

2008-12-28 Thread Michael Geary
There must be something else going on with your code other than the snippet you've posted here. It's hard to believe that a local variable would not work properly in Firefox. If you could post a link to a complete test page, I'll bet someone could tell you what is going wrong. -Mike > From: Lia

[jQuery] Re: Variable scope: Newbie Question

2008-12-06 Thread Mat
Wow I'm chatty aren't I... I just wanted to add I changed my code to this $(function() { $.ajax({ type: "GET", url: "xml/location.xml",

[jQuery] Re: Variable scope: Newbie Question

2008-12-06 Thread Mat
One thing I do notice with my code is that it is slow. If I change provinces and type in the city field and change provinces again things slow right down. I know this must be due to the way I have coded this. I am wondering if you have any suggestion to improve the speed of things? The form will p

[jQuery] Re: Variable scope: Newbie Question

2008-12-06 Thread Mat
Hi Micheal, Thank you so much for that. I knew I was getting close to a solution but I was well and truly stuck. It is now working and I am delighted. This is the code that worked for me success: function(xml) { towncity = []; $(xml).find("[EMAIL PROTECTED]'"+ currprov +"'] > TO

[jQuery] Re: Variable scope: Newbie Question

2008-12-05 Thread Michael Geary
Hi Mat, 1) You're defining towncity like this: var towncity = window.towncity = new Array(); That creates both a local variable named towncity and a window property (global variable) of the same name. Is that what you want? Do you need to use towncity outside this code? If not, I would chan

[jQuery] Re: Variable Scope

2008-10-13 Thread QuickScriptz
I tried it out and it fixes the problem - thanks a ton Michael!

[jQuery] Re: Variable Scope

2008-10-10 Thread QuickScriptz
Thanks Michael. I'll try that out and see where I get!

[jQuery] Re: Variable Scope

2008-10-08 Thread Michael Geary
A loop doesn't "print out" the code. A function call *does*, in a manner of speaking. I didn't look at the rest of your code in any detail, but if you want the loop to work more the way you're expecting, where it saves the individual loop values for "i" and the other variables you set up inside

[jQuery] Re: Variable Scope

2008-10-08 Thread QuickScriptz
Sorry about that MorningZ. My original question actually had to do with whether somehow the value of the variable was being lost because of the fact that when I went to actually use the variable it was nested inside some other code blocks but what Dave said answers my question. > The closure is w

[jQuery] Re: Variable Scope

2008-10-08 Thread Dave Methvin
> I have a row of icons and the idea is when you mouseover, a popup > () appears below it and then when you mouseout, it fades again. There are a lot of plugins that do this, like tooltip, cluetip and jtip. Did you want to do something special? > $(nowPopup).css({left: leftPxS}); The clo

[jQuery] Re: Variable Scope

2008-10-08 Thread MorningZ
So what exactly is the question/problem with "variable scope"? Are you losing the scope somewhere? Are you asking if there's a better way? it's not clear at all On Oct 8, 10:00 pm, QuickScriptz <[EMAIL PROTECTED]> wrote: > So I've been over my code again and again and I've scoured through the