Attempting to use AJAX to populate my Gridview, keep running into roadblocks. I have a simple grid which should be filled on pageLoad by ajax. Not matter what I do, I get a FILED Alert from my ajax call but I really don't know where to look.
This is my first attempt at using AJAX to get my Data for me. Any proper examples or help on the code below would be greatly appreciated.
<script>$.ajax({ type: "POST", url: "WebService.asmx/GetCemeteries", data: '{}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { //alert(JSON.stringify(data)), alert('success'); }, error: function (data) { alert('failed'); } });</script><asp:GridView ID="Grid" runat="server" AutoGenerateColumns = "false" EmptyDataText="Your Query did not return any data. Please try again with new Search Criteria." DataKeyNames="ID" allowPaging ="true" ShowFooter = "true" OnPageIndexChanging = "OnPaging" onrowediting="Editthis" Width="100%" CssClass="table table-striped table-bordered table-condensed" onrowupdating="Updatethis" onrowcancelingedit="CancelEdit" PageSize = "10"><pagersettings position="TopAndBottom"/> <PagerStyle CssClass="pagination-ys" /><Columns></Columns></asp:GridView>
WebService
<WebMethod()> _ Public Function GetCemeteries(Cemetery As Business.Cemetery) As String Dim Cemeteries As List(Of Business.Cemetery) = Business.Cemetery.Search.GetEntity(Cemetery.Name) Return JsonConvert.SerializeObject(Cemeteries) End Function