c# - ASP.Net Model to Javascript - Passing Data from server to client -
hey guys quick question best approach on converting model javascript.
i tried using
@{ var arr = new string[3]; arr[0] = "1"; arr[1] = "2"; arr[2] = "3"; var jason = jsonconvert.serializeobject(model); } <script type="text/javascript"> var string = '@jason'; var variable2 = jquery.parsejson(string); alert(variable2.id); </script>
as can guess did not work, through sample of jquery should work not sure if compatible jsonconvert of .net
its first time on programming in client side quite simple question tried looking answer net. see uber complicated answers , @ least 3 , higher old guessing there should easier way now?
Comments
Post a Comment