c# - how to access the value of javascript variable in a normal class file variable -


i have value of java script variable in normal class variable. found out 1 solution of creating hidden field can created in .aspx page , java script variable value assigned field in .aspx.cs file only. value assign should occur on ajax call on click of button of page.(on click calling ajax functioning aspx page postback won't occur , won't able assign java script variable value hidden field. hope question clear.

you have 2 options: 1. send part of url (query string parameter) 2. add data sending via ajax

<script>     var test = "testvalue";     //ajax call     //option 1     $.ajax({         url:'<your url>'+ '?test=' + test,         type:'post',         ...     }).success(function(d){ ..})      //option 2     var data = {};     data.test = test;     .....//add other stuff      $.ajax({         url:'<your url>',         type:'post',         data:json.stringify(data),         ......     }).success(function(d){}); </script> 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -