url routing - Javascript url content with parameter? -
i wish pass 'selectlang' parameter in javascript , redirect mvc controller var 'selectlang' have error , mention not exist in current content? please guide me thanks!
my javascript:
$('.filterlang').on("click", function () { var selectlang = document.getelementbyid("language").value; location.href = '@url.content("~/surv_main/surv_main_details/?key=" + model.survey_key +"&language=" + selectlang)'; });
filterlang button class , "language" dropdownlist id.
have tried this:
$(document).on(".filterlang", "click", function(){ var selectedlang = $("#language").val(); // if normal dropdown, work both cases var selected2lang = $("#language").select2("val"); // if select2 dropdown window.location = '@url.content("~/surv_main/surv_main_details/?key=" + model.survey_key +"&language=' + selectlang + '")'; });
hope helps.
Comments
Post a Comment