Matt,
Thanks for the reply. Firebug... I wouldn't have made through my first
week of learning Prototype without Firebug. Invaluable tool. Web
Developer plugin is also extremely handy.
I have another function that uses Ajax.Request and it works as
expected. I actually prefer the Ajax.Request call to Ajax.Updater. It
seems to have more control except that it stripped out my JavaScript
code rendering it worthless.
All that said, I believe I have it working. I think it boiled down to
a variable name conflict, still not quite sure. I had the variable
named 'element' which seemed to conflict with the Prototype element
object.
I changed this:
element.update('<strong>Error Loading Content</strong>');
To:
$(elementID).update('<strong>Error Loading Content</strong>');
Thanks again for the help.
Mike
On Jul 18, 4:05 pm, Matt <[EMAIL PROTECTED]> wrote:
> Hey MMason,
>
> You're correct, element is defined in that scope, i retract
> my previous prescription.
>
> I'd recommend using Ajax.Request to see if you're method is
> working. What I believe could potentially be causing the problem is
> the Updater's native code is attempting to update the element after
> your onFailure function has already updated it, in which case you
> might see some odd behavior, but i am not sure of that.
>
> I also highly highly recommend downloading firebug for help
> with debugging ajax applications, it allows you to monitor all XHR
> requests, you can read the XHR's post request variables and its
> response, whether it fails or not.
>
> Cheers,
> Matt
>
> On Jul 16, 11:29 pm, MMason <[EMAIL PROTECTED]> wrote:
>
> > I copied just a small block out of a larger function. Here is the
> > entire function where 'element' is defined:
>
> > updatePod = function(url,headerText,elementID,headerID){
> > var element = $(elementID);
> > var header = $(headerID);
> > // Random identifier for created div layers.
> > var randID = 'elem' + Math.random();
> > // onCreate
> > element.hide();
> > // Insert loading graphic
> > new Insertion.After(elementID,'<div id="' + randID + '"
> > style="padding:5px;"><img src="../assets/images/icons/loading.gif"
> > width="18" height="18" align="absmiddle"> Loading...</div>');
> > // Change the header
> > header.update(headerText);
>
> > //Update the region
> > new Ajax.Updater(elementID, url, {
> > method: 'get',
> > evalScripts: true,
> > onSuccess: function(transport) {
> > showElement(elementID);
> > hideElement(randID);
> > },
> > onFailure: function() {
> > element.update('<strong>Error Loading Content</strong>');
> > }
> > });
>
> > }
>
> > Should this work?
>
> > Thanks for the quick reply,
> > MIke
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---