views:

325

answers:

1

I would try something like this but it isn't allowed.

function GetDynamicModulesProperties() {
    var selectedValue = $("#moduletype option:selected").val();
    if (selectedValue.lenght() > 0) {

        var url = '<%= Url.Action("GetModuleProperties", new { sectionid = ViewData.Model.Id, moduleTypeId = selectedValue } ) %>';
        var renderContainer = $("#modulesettings");
        $.get(url, function(data) {
            renderContainer.html(data);
            renderContainer.fadeIn('slow');
        });
    }
}

is there a an way to do this?

Thanx in advance

A: 

do the val() on the select to get the selected option value.

var selectedValue = $("#moduletype").val();

to get it from the option you would use the following however there is no point in the extra key presses:)

 var selectedValue = $("#moduletype>option:selected").attr('value');
redsquare