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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -