I have a Model, Customers, in which I have a list property, PayHistory. I need to bind the table with the PayHistory object using jQuery in my ASP.NET MVC (C#) application.
I am binding the table using jQuery as:
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <div id="PaidDate"> </div> </td> <td> <div id="PaidAmt"> </div> </td> </tr> </table> <script type="text/javascript" language="javascript"> $(document).ready(function() { //Initialize the dynamic Value; _dynId = 1; var data= '<%= Model.PayHistory %>'; if (data != null) { for (i in data) { var pay= data[i]; $('#PaidDate').append('<div id="PaidDate' + _dynId + '" style="height:20px;padding-left:10px;">' + '<label>' + pay.paidDate+ '</label>'); $('#PaidAmt').append('<div id="PaidAmt' + _dynId + '" style="height:20px;padding-left:10px;">' + '<label>' + pay.PaidAmount + '</label>'); _dynId += 1; } } }); </script> In the above HTML, I am trying to access the list object PayHistory in jQuery, but it gives the type of the object.
How can I access the object in jQuery to bind the table as in the HTML given above?