There are several potential issue with the code shown. Please take a few moments to debug your code using the Visual Studio debugger and the browser's dev tools (F12).
For example, the LoadData action is looking for POST parameters (form) but the AJAX is submitting an HTTP GET.
According to the code you provided, there are some details that need to be modified.
singhswat
@{ Layout = null; }
First,I find that your view does not refer to the _Layout.cshtml as shown above, but the JS of your page and the links to the referenced files are in @section scripts{}.
A section allows you to add something in a view which will be added in the layout,so it's not necessary to use @section scripts {} on your current page, and that's why no JS event was triggered.
Member
74 Points
215 Posts
JQuery Datagrid data not displayed
Jun 19, 2019 05:29 PM|singhswat|LINK
Hi
... Can someone please help me with JQuery datatables...
Problem - For some reason its not displaying data... No errors anywhere..
ControllerCode
All-Star
43701 Points
18703 Posts
Re: JQuery Datagrid data not displayed
Jun 19, 2019 05:35 PM|mgebhard|LINK
There are several potential issue with the code shown. Please take a few moments to debug your code using the Visual Studio debugger and the browser's dev tools (F12).
For example, the LoadData action is looking for POST parameters (form) but the AJAX is submitting an HTTP GET.
Contributor
2760 Points
784 Posts
Re: JQuery Datagrid data not displayed
Jun 20, 2019 04:32 AM|Yongqing Yu|LINK
Hi singhswat,
According to the code you provided, there are some details that need to be modified.
First,I find that your view does not refer to the _Layout.cshtml as shown above, but the JS of your page and the links to the referenced files are in @section scripts{}.
A section allows you to add something in a view which will be added in the layout,so it's not necessary to use @section scripts {} on your current page, and that's why no JS event was triggered.
Secondly,to reference css file, you need to use link tag instead of script tag like this:
Thirdly,I find that the url in your ajax is "/ServiceType/LoadData",however,according to the code you provided,your controller name is:
So, you need to change the url to "/ServiceTypes/LoadData".
In summary, after you modify the code, I suggest you use breakpoints and F12 to debug your code, which will help you solve your issue easierly.
Best Regards,
YongQing.
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.