the div object doesn't have value property,

and it's better to make a request insted a updater

new Ajax.request('randy.php?ajax=1,{
    parameters:{
       parameter1:'value1',
       parameter2:'value2',
       .......
    },
    onSuccess: function(transport){
        var test = $('testdiv');//it's equal to document.getElementById
('testdiv')
        if("SomeString" != test.innerHTML)
           test.update(transport.responseText);
    }
});

for more information:

http://www.prototypejs.org/api

http://www.prototypejs.org/api/utility/dollar

the general options of the Ajax object

http://www.prototypejs.org/api/ajax/options

And the periodical updater

http://www.prototypejs.org/api/ajax/periodicalUpdater

Elden.


On Wed, Feb 13, 2008 at 2:41 AM, fben125 <[EMAIL PROTECTED]> wrote:

>
> This is really bugging me no matter what I'm trying.
> In javascript, I'm using the ajax.updater, and it (obviously) writes
> back out to a div. I want to then compare what was echoed out into
> this div (which came from the php file I listed in ajax.updater) with
> a string.
>
> test should equal "SomeString" because that is what is being echoed
> out to 'testdiv', but it doesn't. Instead, when I try debugging and
> display test in a div, it shows up as "undefined."
>
> Here is example code:
>
> function Check(){
>
> new Ajax.Updater('testdiv','randy.php?ajax=1',
> {method:'post',parameters:'somevar='+somevalue,evalScripts:false});
> //wha la, testdiv now displays "SomeString". but wait! crap!.....
>
> test = document.getElementById('testdiv').value;
>
> if (test == "SomeString"){
>
> document.getElementById('testdiv').innerHTML=test;
> return true;
> }
> }
>
> Thanks for any advice.
> >
>


-- 
{a human being that was given to fly}

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to