Hopefully, the lack of quotes around the ID is just a typo in Mail,  
right?

What do you see back in Firebug when you send the request?

If it looks like <div id="testdiv">Correct</div>, then your test  
might work. I would put the variables in the other order myself, but  
I don't know if it matters really:

if ($('testdiv').innerHTML == "Correct") ...

Walter


On Feb 13, 2008, at 5:52 PM, fben125 wrote:

>
> Thanks for the new direction, though I wasn't able to get it to work
> yet. I am not getting anything back. The php file I have now is just
> echoing out "<div id=testdiv">Correct</div> if sendcode equals some
> session variable I have. But it's not echoing anything back onto the
> screen, and nothing happens. :\
>
> Here is the function, any ideas?:
>
> function codeCheck(){
>
> sendcode = document.getElementById('code').value;
>
> new Ajax.request('functions/randy.php',{
>     method: 'post',
>     postBody: escape('id='+sendcode),
>     onSuccess: function(t){
>         var test = $('testdiv');
>         if("Correct" == test.innerHTML)
>            test.update(t.responseText);
>     },
>     onFailure: function(t) {
>         alert('Error ' + t.status + ' -- ' + t.statusText);
>     },
>     on404: function(t) {
>         alert('Error 404: location "' + t.statusText + '" was not
> found.');
>     }
> });
>
> }
>
>
> the php file is something like:
>
> if(isset($_POST['id'])){
>
> $id=$_POST['id'];
>
> if ($id == $compare){
>
> echo "<div id=testdiv>Correct</div>";
>
> die();
>
> }
> >


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