Question

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();
}
);

});
Was it helpful?

Solution

Found it!

var parameter = $('ddl').get('value');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top