// THIS IS MY JAVA SCRIPT CODE
<script type="text/javascript"> function getAllMessages() { $.ajax({ url: "TestService.asmx/GetAllMessages", dataType: "json", method: "GET", contentType: "application/json", success: onSuccess, error: function (err) { console.log(err); } }); } function onSuccess(data) { console.log(data); var messageTable = $("#messages tbody"); alert(data); $(data).each(function (index, msg) { var apnString = "<tr><td>" + msg.ID + "</td><td>" + msg.Email + "</td><td>" + msg.Message + "</td><td>" + msg.TimeStamp + "</td></tr>"; messageTable.append(apnString); }); } </script> // WebMethod Code