ok i may have figured out why this is happening.
i put replaces alert(dupsfound) with setTimeout('alert(dupsfound)',3000) so
that the script waited 3 seconds before displaying the alert and then it
displayed the correct value

so the key is that it IS settign the value properly but it just takes a
minute for the post to complete.

so.... the next question is, how do i prevent the rest of the function from
running until the post is finished?



Rob Desbois-2 wrote:
> 
> That should work if errorsFound is global - can you provide your code or
> give us a link to look at?
> --rob
> 
> On 7/19/07, bdee1 <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> i am building a function to validate a registration form for my site. 
>> one
>> of
>> the things i need to validate is that the email address entered into the
>> form does not already exist in the database.
>>
>> in my formValidate function i perform several tests.  if a test fails i
>> increment a errorsFound variable.  at the end of my function if
>> errorsFound
>> is greater than 0, i do not submit the form.
>>
>> the test for my email field does a $.post to a checkEmail - a page that
>> checks the database for duplicate email addresses.  then my callback
>> function looks st the results of the post - if duplicates were found, i
>> increment my errorsFound variable.
>>
>> problem is that from within my $.post callback function i cannot seem to
>> access my errorsFound variable.
>>
>> how can i get my post callback function to increment my errorsFound
>> variable?
>> --
>> View this message in context:
>> http://www.nabble.com/changing-the-value-of-a-global-variable-inside-an-post-callback-function--tf4111860s15494.html#a11691585
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Rob Desbois
> Eml: [EMAIL PROTECTED]
> Tel: 01452 760631
> Mob: 07946 705987
> "There's a whale there's a whale there's a whale fish" he cried, and the
> whale was in full view.
> ...Then ooh welcome. Ahhh. Ooh mug welcome.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/changing-the-value-of-a-global-variable-inside-an-post-callback-function--tf4111860s15494.html#a11693506
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to