$(document).observe("dom:loaded", function(){
  $("ctlJob").observe("change", function(){
    new Ajax.Request("/select.php", {
      postBody: $H({id: $(this).val(), ajax: 'true'}).toQueryString(),
      onSuccess: function(res){
        var j = res.responseText.toJSON(), options = '';
        for (var i = 0; i < j.length; i++) {
          options += '<option value="' + j[i].optionValue + '">' +
j[i].optionDisplay + '</option>';
        }
        $("ctlPerson").update(options);
      }
    })
  })
})

No guarantees (I pasted the jQuery version into an editor and hacked it up
;)) but that's the gist of it.

-Fred

On Thu, May 29, 2008 at 12:30 PM, Chris <[EMAIL PROTECTED]> wrote:

>
> Hello is there an easy way to autopopulate select boxes like this
>
> http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/
> but using prototype?
> Thank you
> >
>


-- 
Science answers questions; philosophy questions answers.

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