I figured out the issue.
It turned out that IE and firefox handles the function ajax calls in
different way.
I have to modify the prototype.js, to add a session id passed to
Ajax.Request.
So instead of function(transport, json), i modified it to
function(transport, json, id) <- to mark a unique session.
It's part of a complicated design, where i dynamically add remove
ordered divs and fetch contents from server.
Thanks!!
On Jul 19, 5:26 pm, "Skip Baney" <[EMAIL PROTECTED]> wrote:
> If I understand you correctly, you are asking why alert3 doesn't show
> your response text.
> That's because the ajax request executes asynchronously....
> this.content is still 'b' at that point and has yet to be changed by
> your handler method.
>
> If you need to execute the ajax request synchronously, there is a flag
> in the options hash to tell it to do so.
>
> I'm not sure why it seems to be working for you in IE... perhaps it's
> just returning faster... or maybe I'm just misunderstanding your
> question.
>
> Hope this helps,
> - Skip
>
> On 7/19/07, Paladin <[EMAIL PROTECTED]> wrote:
>
>
>
> > And I found this weird behavior in ie and firefox.
> > In ie it seem to work but in firefox no.
>
> > On Jul 19, 4:08 pm, Paladin <[EMAIL PROTECTED]> wrote:
> > > Very simple task to do but never get it work.
> > > say I have a class called track
>
> > > function Track(){
> > > this.id = 'a';
> > > this.content = 'b';
>
> > > }
>
> > > Track.prototype.update(){
> > > this.content = 'b';
> > > alert(this.content) //alert1
> > > options.onSuccess = this.handle.bind(this);
> > > new Ajax.Request(url, options);
> > > alert(this.content); //alert3
>
> > > }
>
> > > Track.prototype.handler(transport){
> > > this.content = transport.responseText;
> > > alert(this.id);
> > > alert(this.content); //alert2
>
> > > }
>
> > > The overall structure is like this.
> > > The funny thing is when executed; alert1 shows 'b', alert2 will show
> > > the responseText, but alert3 will still be b.
> > > The modification of this.content in the handler can't have global
> > > effect. However, when alert this.id in the handler, you will see
> > > this.id working. It seems that things are messed up in the scoping of
> > > ajax request. Anyone has any clue how to work around ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" 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/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---