Jos*_*ard 6 ajax mvc-mini-profiler
我在MVC 4应用程序上使用MiniProfiler.我们有一个视图以模态呈现(使用Colorbox jquery插件).那个视图在其中有一个局部视图,其中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>
}
Run Code Online (Sandbox Code Playgroud)
当我们提交表单时,它返回相同的局部视图以覆盖视图上的整个部分.发布时,MiniProfiler会抛出错误:SyntaxError:意外的令牌,
这发生在这个函数中:
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);
}
}
};
Run Code Online (Sandbox Code Playgroud)
它期待一个json的guids数组,但是它得到了两次数组,如下所示:
"["6de0e02c-e694-4d8a-ac22-ea6a847efe0e","970f6640-fe5b-45d9-bf59-c916b665458d"],["6de0e02c-e694-4d8a-ac22-ea6a847efe0e","970f6640-fe5b-45d9-bf59-c916b665458d" "]"
这会导致它在尝试解析数组时发出呕吐.我不确定为什么数组会重复.任何帮助将不胜感激.谢谢!
| 归档时间: |
|
| 查看次数: |
290 次 |
| 最近记录: |