JSON中出现意外的令牌c

时间:2016-06-22 16:24:52

标签: javascript jquery kendo-ui kendo-grid

将JSON更新发送到WebAPI Web服务并处理datasource_error事件时,我收到错误

SyntaxError: Unexpected token c in JSON at position 0
at Object.parse (native)
at n.parseJSON (http://localhost:50745/Scripts/kendo/2016.2.504/jquery.min.js:4:16756)
at Xb (http://localhost:50745/Scripts/kendo/2016.2.504/jquery.min.js:4:19069)
at y (http://localhost:50745/Scripts/kendo/2016.2.504/jquery.min.js:4:22515)
at XMLHttpRequest.c (http://localhost:50745/Scripts/kendo/2016.2.504/jquery.min.js:4:26989)

一切都像它应该的那样工作但我不希望除非出现错误而触发事件。我不知道如何弄清楚它在谈论什么

回复文字是

"callback({"Divison":"roma","SupplierNumber":"054940","OpcoID":"PFRD","ProductID":"590110","ProductPack":"other","ProductDescription":"Apple Red Del X Fcy Wash","localei":0.5,"CorpEi":0.55,"corpmktei":1,"corpmkteiadj":0,"OpcoMktngEL":null,"OpcoEi":null,"spoilage":0,"processingFee":0.075})"

我如何弄清楚发生了什么

这是我的数据源

  dataSource: {
            transport: {
                read: {
                    url: "/EarnedIncome/GetProducts",
                    cache: false,
                    datatype: "json",
                    data: function () {
                        return {
                            division: $("#division option:selected").text(),
                            opcoID: $("#opco option:selected").val(),
                            supplierNumber: $("#supplier option:selected").val(),
                            productID: $("#productcode").val()
                        };
                    }

                },
                update: {
                    url: "/EarnedIncome/UpdateProduct",
                    dataType: "json",
                }
                ,
                parameterMap: function (options, operation) {
                    if (operation !== "read" && options) {
                        return { models: kendo.stringify(options) };
                    }
                    if (operation === "read") {
                        return {
                            division: $("#division option:selected").text(),
                            opcoID: $("#opco option:selected").val(),
                            supplierNumber: $("#supplier option:selected").val(),
                            productID: $("#productcode").val()
                        };
                    }
                }
            },
            change: function (e) {
                if (e.action == "itemchange") {
                    this.sync();
                    // this.saveChanges();
                    $("#EarnedIncomeGrid .k-dirty-cell").removeClass('k-dirty-cell');

                    var popupNotification = $("#popupNotification").kendoNotification(
                            {
                                position: {
                                    top: $(document).height() / 2 + 300,
                                    right: $(document).width() / 2
                                },
                                allowHideAfter: 500,
                                stacking: "down"

                            }
                        ).data("kendoNotification");
                    var staticNotification = $("#staticNotification").kendoNotification({
                        appendTo: "#appendto"
                    }).data("kendoNotification");
                    popupNotification.show("Cell Saved", "success");
                }
            },
            schema: {
                data: "Data",
                total: "Total",
                model: {
                    id: "ProductID",
                    fields: {
                        ProductID: { type: "string", editable: false },
                        ProductPack: { type: "string", editable: false },
                        ProductDescription: { type: "string", editable: false },
                        CorpEl: { type: "string", editable: true },
                        OpcoEL: { type: "string", editable: true },
                        OpcoMktngEL: { type: "string", editable: true },
                        spoilage: { type: "string", editable: true },
                        processingFee: { type: "string", editable: true },
                    }
                }
            },
            pageSize: 15,
        },

0 个答案:

没有答案