TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
L A
NA
170
171.2k
jQuery DataTables - Can't bind data
Mar 31 2017 3:51 PM
Hi all,
My application (ASP.NET MCV) refrences a Webservice to GET data & display using DataTables jQuery (https://datatables.net/).
Created ajax function to call Controller/ Action.
<script src=
"~/Scripts/jquery.js"
></script>
<script src=
"~/Scripts/DataTables/jquery.dataTables.js"
></script>
<script src=
"https://cdn.datatables.net/v/dt/dt-1.10.13/datatables.min.js"
></script>
<script type=
"text/javascript"
>
$(document).ready(
function
() {
$.ajax({
type:
'POST'
,
url:
'@Url.Action("GetDetailsFromService", "GetProductData")'
,
dataType:
"json"
,
success:
function
(DBdata) {
alert(DBdata);
//Data To Display in Alertbox
$(
'#productDataTable'
).DataTable({
data: DBdata,
columns: [
{
"data"
:
"ProductName"
},
{
"data"
:
"SupplerName"
},
{
"data"
:
"CategoryName"
}]
});
}
});
});
</script>
Consumed Webservice data to show.
[HttpPost]
public
ActionResult GetDetailsFromService()
{
ProductDetails.GetDetailsService service =
new
ProductDetails.GetDetailsService();
JavaScriptSerializer json =
new
JavaScriptSerializer();
return
Json(json.Serialize(service.GetProductData()), JsonRequestBehavior.AllowGet);
}
JSON data shown in alert box from webservice.
Can't bind data to jQuery DataTable
Please help me out, to figure whats the problem.
Reply
Answers (
2
)
insert update delete operation in popup in mvc
Cant see cause of model item passed into the ViewDataDictio