javascript - Passing parameter to @Url.Action based on jquery hasClass output -


i trying pass integer parameter url.action based on hasclass output of jquery. below invalid syntax.

<li class="myclass">     <a href="@url.action("setactionmode", "home",  new { enable = $(this).find('i').hasclass("fa-check") ? 0 : 1 })">       <i class="fa fa-check"></i> debug mode     </a> </li> 

what correct syntax above or there easy way this?

i'd should 'interrupt' link clicking, construct url , go url.

$(".myclass a").click(function(event) {     event.preventdefault();     var url = $(this).attr('href');     // here whatever makes sense     url = url + "?enable=" + ($(this).find('i').hasclass("fa-check") ? 0 : 1)     window.location.href = url;  }); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -