Setting up the value in ViewBag using Jquery

Viewed 87190

I just want to ask, is there a way to set up the viewbag value dynamically using jquery? I try this code in my script,

$(".btn").on("click",function(){
@ViewBag.Id = $(this).attr("id")
});

i dont know if its correct but when i try to run my MVC 3 Project, this error appear in my firebug

Syntax Error
    = $(this).attr("id")

Please Help. Thanks

1 Answers
Related