I am not sure what you are trying to do. But you may consider looking
at the Ajax.Updater.
But, the reason that is undefined is because you are treating the Ajax
call as synchronous. Anything you need to do with responseText needs
to be done in the onComplete function.
nds
On 2/6/07, Matthew Williams <[EMAIL PROTECTED]> wrote:
>
> I'm using a class I found that evals responseText from AJAX.Requests,
> judging by my Firebug results it works like a charm, however, I'm
> having difficulty displaying the data in a DIV.
>
> Code:
> <script>
> Ajax.Eval = Class.create();
> Object.extend(Object.extend(Ajax.Eval.prototype,
> Ajax.Request.prototype), {
> initialize: function(url, pars) {
> this.transport = Ajax.getTransport();
> this.setOptions({method:'post', parameters:pars});
> this.options.onComplete = (function(transport) {
> eval(transport.responseText);
> });
> this.request(url);
> }
> });
> function runAjax(target) {
> var myAjax = new Ajax.Eval('getlrudetail.cfm?id=30020',
> {method:'get'});
> $(target).innerHTML = myAjax.responseText; // Returns "Undefined" in
> my DIV space.
> }
> </script>
>
> I'm pretty new to JavaScript in general but I'm working on an internal
> AJAX app (which is working wonderfully, but it's a big hack so I'm
> trying to go about re-developing the proper way).
>
> I think the code is pretty self-explainatory, I just need a way to
> display the responseText from the call.
>
> Thanks!
>
>
> >
>
--
Blog: http://www.simpltry.com/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---