gpt4 book ai didi

ajax - MiniProfiler 使用 Ajax.BeginForm 抛出意外 token

转载 作者:行者123 更新时间:2023-12-04 16:10:22 25 4
gpt4 key购买 nike

我在 MVC 4 应用程序上使用 MiniProfiler。我们有一个以模式呈现的 View (使用 Colorbox jquery 插件)。然后该 View 中有一个局部 View ,其中包含一个 ajax 形式,如下所示:

@using(Ajax.BeginForm("<action name>", "<controller name>", new {area="<area name>"}, new AjaxOptions
{
UpdateTargetId = "modal-body",
InsertionMode = InsertionMode.Replace,
HttpMethod = "POST"
}))
{
<html for form here>
}

当我们提交表单时,它返回相同的部分 View 以覆盖 View 上的整个部分。当它发布时 MiniProfiler 抛出一个错误: SyntaxError: Unexpected token ,

这发生在这个函数中:
var jQueryAjaxComplete = function (e, xhr, settings) {
if (xhr) {
// should be an array of strings, e.g. ["008c4813-9bd7-443d-9376-9441ec4d6a8c","16ff377b-8b9c-4c20-a7b5-97cd9fa7eea7"]
var stringIds = xhr.getResponseHeader('X-MiniProfiler-Ids');
if (stringIds) {
var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds);
fetchResults(ids);
}
}
};

它期待一个 json 的 guid 数组,但它获得了两次数组,如下所示:

“[” 6de0e02c-e694-4d8a-AC22-ea6a847efe0e “”970f6640-fe5b-45d9-bf59-c916b665458d“],[ ”6de0e02c-e694-4d8a-AC22-ea6a847efe0e“,” 970f6640-fe5b-45d9-bf59-c916b665458d “]”

这会导致它在尝试解析数组时呕吐。我不确定为什么数组会重复。任何帮助将不胜感激。谢谢!

最佳答案

这是一个 miniprofiler 错误 https://github.com/MiniProfiler/ui/pull/5

等待下次更新。

关于ajax - MiniProfiler 使用 Ajax.BeginForm 抛出意外 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20378433/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com