MiniProfiler throws unexpected token with Ajax.BeginForm

I use MiniProfiler in an MVC 4 application. We have a view that displays in modal (using the jQuery Colorbox plugin). This view then has a partial view in it with an ajax form that looks like this:

@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> } 

When we submit the form, it returns the same partial view to rewrite this entire section in the view. When he published the MiniProfiler gives an error message: SyntaxError: Unexpected token,

This happens in this function:

 var jQueryAjaxComplete = function (e, xhr, settings) { if (xhr) { // should be an array of strings, eg ["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); } } }; 

It expects an array of json json arrays, but instead it gets an array twice, for example:

<">" ["6de0e02c-e694-4d8a-ac22-ea6a847efe0e", "970f6640-fe5b-45d9-bf59-c916b665458d"], ["6de0e02c-e694-4d8a-ac22-ea6a847efeb66" bf59-c916b665458d "]"

This makes him puke when he tries to parse the array. I am not sure why the array is duplicated. Any help would be greatly appreciated. Thanks!

+6
source share
1 answer

This is a microprocessor error https://github.com/MiniProfiler/ui/pull/5

Wait for the next update.

0
source

Source: https://habr.com/ru/post/959331/


All Articles