Take a look through the examples on the Greasemonkey / Greasespot wiki
for where to add the onload code.

http://wiki.greasespot.net/GM_xmlhttpRequest#Examples


The problem that you are experiencing is an issue with 'closure's:

http://wiki.greasespot.net/Closure


kwah


On 8 August 2011 01:41, al azif <[email protected]> wrote:
> So what should I do ? :/
>
> On Aug 8, 2:18 am, John Plsek <[email protected]> wrote:
>> No, as Anthony said, the problem is in your code, the GM_setValue function
>> works exactly as it should
>>
>> On 8 August 2011 03:35, al azif <[email protected]> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > The problem is with the GM_setValue function i think because the
>> > values in alerts are all right. The values are correct for every loop.
>> > But setValue is not working ..
>>
>> > On Aug 7, 7:40 pm, Anthony Lieuallen <[email protected]> wrote:
>> > > On 2011-08-07 12:31 PM, al azif wrote:
>>
>> > > > GM_getValue("store","error"); takes the value on the first loop, but
>> > > > on the next ones it gives out "error". So the values are empty. It
>> > > > shows that there is a problem with the GM_setValue function. It only
>> > > > works on first loop.. What shall I do, Have any idea?
>>
>> > > This is a classic programming error with loops in javascript.  The
>> > > GM_xhr callback on complete is not happening until after the entire loop
>> > > has completed.  This for every iteration of the loop, you're trying to
>> > > get the value you just deleted.
>>
>> > > Put the code actually using the GM_xhr onload values in the onload
>> > callback.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "greasemonkey-users" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > For more options, visit this group at
>> >http://groups.google.com/group/greasemonkey-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "greasemonkey-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/greasemonkey-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to