Thanks TJ, I tried to make a self-contained version, so I ripped out
prototype and did the same thing with object literals, and I still had
issues, so clearly it wasnt prototype.
In the end I figured out that the button which fired off the AJAX
request (ie the "Submit" button) was inside a form (I did not want it
to actually do an HTTP POST submission of the form, just call JS code)
and I had not disabled the form with onsubmit='return false', so when
I clicked submit, it was submitting the form, thus destroying the
button that made the AJAX call before the reply came back.

I had noticed that putting an alert or delay into the script caused it
to work and was tearing my hair out - obviously the delay stopped the
button being destroyed long enough for the AJAX request to come back.

Oh the joys of Asynchronous web coding.

I now have a slightly different problem, with the same button...

Once the AJAX reply comes back that the data was updated, I want to
destroy the form. But it won't let me. I guess for a similar reason to
my explanation above - the button started the call, and it is in the
response code that I wish to destroy it, so it technically hasn't
finished yet. I hope that all makes sense. If not, I will try and rig
some self contained code using the system you linked - I guess for the
ajax request I could just get it to grab a css file or something off
the server?

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.


Reply via email to