I am declaring variable in the click of a link in MVC. Assigning it the value of the "li" text I want to access this variable in my Html page. Or we can say outside the script.
Here is the code snippet.I just want the value of name variable to be accessed on the page.
<script type="text/javascript">
$("a.commentLink").live("click", function () {
var name = $(this).closest("li").text();
});
</script>
Thanks in advance.