Я пытаюсь построить строку запроса с 2 аргументами, но это не удается. Я получаю: Uncaught SyntaxError: Неожиданная строка
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx * хххххххххх


1012 **1013* Я могу построить его с 1 аргументом успешно:
"render": function (data, type, full, meta) {
return '<a href="@Url.Action("BlogsForMaintIndex", "BlogMaint")?blogCategoryId=' + data +
'">Select</a>';
Вот полный код:
namespace GbngWebClient.Models
{
public class BlogCategory
{
public int BlogCategoryId { get; set; }
public string BlogCategoryDescr { get; set; }
public string BlogTitle { get; set; }
}
}
@section Scripts
{
<script type="text/javascript">
var blogcategoryListVM;
$(function () {
blogcategoryListVM = {
dt: null,
init: function () {
dt = $('#blogcategory-data-table').DataTable({
"serverSide": true, // For processing server-side.
"processing": true, // For showing the progress bar.
"ajax": {
"url": "@Url.Action("GetBlogCategorys", "BlogMaint")",
"data": function (data) {
},
"error": function (xhr, error, code) {
alert('Error in Index.cshtml gettting the blog category. Xhr status: ' + xhr.status + '. Xhr status text: ' + xhr.statusText);
}
},
"columns": [
{
"title": "Action",
"data": "BlogCategoryId",
"searchable": false,
"sortable": false,
"render": function (data, type, full, meta) {
return '<a href="@Url.Action("BlogsForMaintIndex", "BlogMaint")?blogCategoryId=' + data + '">Select</a>';
}
},
{ "title": "Blog Category", "data": "BlogCategoryDescr", "searchable": true },
{ "title": "Blog Title", "data": "BlogTitle", "searchable": true }
],
"lengthMenu": [[10, 25, 50, 100], [10, 25, 50, 100]],
});
}
}
blogcategoryListVM.init();
});
</script>
}
Теперь я хочу передать BlogCategoryDescr в качестве аргумента.
Я заменяю
"data": "BlogCategoryId",
return '<a href="@Url.Action("BlogsForMaintIndex", "BlogMaint")?blogCategoryId=' + data +
'">Select</a>';
на
"data": function (data) {
data.BlogCategoryId = BlogCategoryId;
data.BlogCategoryDescr = BlogCategoryDescr;
},
return '<a href="@Url.Action("BlogsForMaintIndex", "BlogMaint")?blogCategoryId=' +
data.BlogCategoryId' + &blogCategoryDescr =' + data.BlogCategoryDescr'">Select</a>';
Вот полный код, который НЕ работает с этими изменениями:
@section Scripts
{
<script type="text/javascript">
var blogcategoryListVM;
$(function () {
blogcategoryListVM = {
dt: null,
init: function () {
dt = $('#blogcategory-data-table').DataTable({
"serverSide": true, // For processing server-side.
"processing": true, // For showing the progress bar.
"ajax": {
"url": "@Url.Action("GetBlogCategorys", "BlogMaint")",
"data": function (data) {
},
"error": function (xhr, error, code) {
alert('Error in Index.cshtml gettting the blog category. Xhr status: ' + xhr.status + '. Xhr status text: ' + xhr.statusText);
}
},
"columns": [
{
"title": "Action",
"data": function (data) {
data.BlogCategoryId = BlogCategoryId;
data.BlogCategoryDescr = BlogCategoryDescr;
},
"searchable": false,
"sortable": false,
"render": function (data, type, full, meta) {
return '<a href="@Url.Action("BlogsForMaintIndex", "BlogMaint")?blogCategoryId=' + data.BlogCategoryId' + &blogCategoryDescr =' + data.BlogCategoryDescr'">Select</a>';
}
},
{ "title": "Blog Category", "data": "BlogCategoryDescr", "searchable": true },
{ "title": "Blog Title", "data": "BlogTitle", "searchable": true }
],
"lengthMenu": [[10, 25, 50, 100], [10, 25, 50, 100]],
});
}
}
blogcategoryListVM.init();
});
</script>
}