How To Make jQuery Read and Parse JSON String using ParseJSON Method in C# Asp.Net
Program:
.Aspx File:
Program:
.Aspx File:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>jQuery Read and Parse Data using ParseJSON method</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script> <script type="text/javascript"> $(function () { var name = ''; var jsonstr = '[{"UserName":"Sizar","UserID":"1"},{"UserName":"surani","UserID":"2"}]'; var obj = $.parseJSON(jsonstr); $.each(obj, function () { name += this['UserName'] + "<br/>"; }); $('#divjson').html(name); ; }) </script> </head> <body> <div id="divjson"> </div> </body> </html> |
Live Demo:
|
No comments:
Post a Comment