Javascript 通过使用ID和显示数据在剑道页面之间导航

Javascript 通过使用ID和显示数据在剑道页面之间导航,javascript,jquery,html,asp.net-mvc,kendo-ui,Javascript,Jquery,Html,Asp.net Mvc,Kendo Ui,在我的MVC项目中,我有两个来自View1的视图,我正在获取一个ID并将其传递给View2。在view2上,我已经有了KendoGrid和控制器,可以为我读取所有数据并显示在网格中 我的问题是如何从View2中的ID获取数据?我在下面复制了View2的脚本代码 var crudServiceBaseUrl = "http://localhost:23355/", dataSource = new kendo.data.DataSource(

在我的MVC项目中,我有两个来自View1的视图,我正在获取一个ID并将其传递给View2。在view2上,我已经有了KendoGrid和控制器,可以为我读取所有数据并显示在网格中

我的问题是如何从View2中的ID获取数据?我在下面复制了View2的脚本代码

            var crudServiceBaseUrl = "http://localhost:23355/",
                dataSource = new kendo.data.DataSource({
                    transport: {
                        read: {
                            type: "GET",
                            url: crudServiceBaseUrl + "/api/SpecificationDetails",
                            dataType: "json",
                            cache: false
                        },
                        update: {


                           // update code goes here
                            },

                        },

                        destroy: {
                            // delete code goes here

                          },
                            create: {
                               // create code goes here
                            },

                            parameterMap: function (options, operation) {
                                console.log(operation + '-' + options.models);
                                if (operation === "create" && options.models) {
                                    options.models[0].SpexHeaderId = 5;
                                    var jsonstr = JSON.stringify(options.models[0])
                                    console.log(jsonstr);
                                    return jsonstr;
                                }



                                else if (operation === "update" && options.models) {
                                    var jsonstr = JSON.stringify(options.models[0])
                                    console.log(jsonstr);
                                    return jsonstr;
                                }
                                else if (operation !== "read" && options.models) {
                                    return { models: kendo.stringify(options.models) };
                                }


                            }
                        },
                        batch: true,
                        pageSize: 4,
                        schema: {
                            model: {
                                id: "SpecificationDetailId",
                                fields: {
                                    SpecificationDetailId: { editable: false, type: "number" },
                                    DescriptionTitle: "DescriptionTitle",
                                    Description: "Description",
                                }
                            },
                            total: function (response) {
                                return response.total;
                            }
                        }

                });

您正在运行jQuery1.5

剑道UI要求jQuery 1.7.1(用于)的最小值。剑道UI的当前官方版本()需要jQuery 1.12.3

请参阅了解您的剑道UI版本所需的jQuery的具体版本。您可以从获取到jQuery任何版本的链接

如果您使用的是遗留代码,则还需要包括


希望这有帮助!:)

您需要在页面上包括
jQuery
(在您引用
$(document.ready()
)之前)。因为您没有包括
jQuery-{version}.js
(或者您的脚本顺序错误)太棒了;很乐意帮忙!一旦你确认这解决了你的问题,请不要忘记点击投票按钮下方的灰色复选框——这会将其从“未回答问题”队列中删除,并为提问者和回答问题者赢得声誉。你可以在提出任何问题15分钟后这样做。当然,在这样说的时候,你没有义务将我的答案(或其他人的答案)标记为正确,尽管将问题标记为已解决有助于保持事情顺利进行:)