jquery - Ajax Table Loading -


i using ajax call load table getting blank page return , data not displaying in table div,

i have tried $('#grouptable').load(data); no luck , please me resolve issue.

ajax call

$.ajax({             type: "post",             url: url,             datatype: "json",             data: { groupnames: json.stringify(buttonid), page: json.stringify(page) },             success: function (data) {                 debugger;                 $('#grouptable').html(data);                 updategroupbuttons();             },             error: function(request, status, error) {                 debugger;                 $('#grouptable').html(request.responsetext);                 updategroupbuttons();             }         }); 

model

public interface ipagedlist : ienumerable {     int pageindex { get; }     int pagesize { get; }     int totalcount { get; }     int totalpages { get; }     bool haspreviouspage { get; }     bool hasnextpage { get; }     string groupbynames { get; }     dictionary<string, ienumerable> group { get; } } 

controller

public jsonresult getgroups(string groupnames, int page = 1)     {         string[] groups=null;         if (!string.isnullorempty(groupnames))         {             groups = new javascriptserializer().deserialize<string[]>(groupnames);         }          var model = _unitofwork.menusetrepository.get().topagedlist(groups, page, 10);         return  json(model, jsonrequestbehavior.allowget);       //  return partialview("getgroups",model);     } 

view

<div id="grouptable">  <table id="tbl" class="table">             <thead>                 <tr>                     @foreach (var property in model.visibleproperties())                     {                         <th draggable="true" ondragstart="drag(event)" id="@property.name"> @property.getlabel()</th>                     }                     <th>actions</th>                 </tr>             </thead>              @if (string.isnullorempty(model.groupbynames))             {                 int index = 0;                 <tbody>                     @foreach (var item in model)                     {                         viewdata[index.tostring()] = item;                         <tr>                             @foreach (var property in item.visibleproperties())                             {                                 <td>                                     @html.display(index + "." + property.name)                                 </td>                             }                             <td>                                 @{                                     routevaluedictionary routevalues = item.getidvalue();                                 }                                  <li>@html.actionlink("edit", "edit", routevalues)</li>                                 <li>@html.actionlink("details", "details", routevalues)</li>                                 <li>@html.actionlink("delete", "delete", routevalues)</li>                              </td>                          </tr>                         index++;                     }                 </tbody>             }             </table>      </div> 

have tried changing line?

datatype: "json", 

to

datatype: "html", 

it tells ajax call kind of data expect server. believe returning pure html?

when tell ajax expect json string automatically parses data finds, array of values.


Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

php - Calling a template part from a post -

How to mention the localhost in android -