Pergunta

I'm trying to initiate an ajax request whenever a person changes the value of a drop down list. I want to send the selected item of the drop down as a query string parameter.

How do I get the selected item from the drop down list using MooTools?

var theUrl = 'http://someurl.com';

window.addEvent( 'domready', function() {

$('ddl').addEvent( 'change',
function(event) {
    var parameter = $('ddl').SOMETHING();  // help!
    new Request({
    url: theUrl,
    data: { 'someParameterId' : parameter },
    method: 'get',
    onComplete: function(data) { alert(data); },
  }).send();
}
);

});
Foi útil?

Solução

Found it!

var parameter = $('ddl').get('value');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top