MiniProfiler用于分析我的ajax请求

时间:2011-12-21 19:41:45

标签: javascript ajax mvc-mini-profiler

如何让MiniProfiler分析我的ajax请求

例如:

<div id="nav">
 <ul>
    <li onclick="javascript:updateContent(1);">foo 1</li>
    <li onclick="javascript:updateContent(2);">foo 2</li>
    <li onclick="javascript:updateContent(3);">foo 3</li>
 </ul>
</div>
<div id="content"></div>

<script type="text/javascript">
    function updateContent(productId) {

        $.ajax({
            url: '@Url.Action("GetProduct", "Product")',
            contentType: 'application/html; charset=utf-8',
            type: 'GET',
            dataType: 'html',
            traditional: true,
            data: {
                productId: productId
            }
        })
            .success(function (result) {
                // Display the section contents.
                $('#content').html(result);
            })
            .error(function (xhr, status) {
                alert(xhr.responseText);
            });
        }
</script>

我希望看到每个updateContent的性能。

有什么想法吗?

我正在使用通过NuGet安装的Asp.net MVC 3和MiniProfiler 1.9

1 个答案:

答案 0 :(得分:6)

已经内置,您不需要做任何特别的事情。

每次执行ajax请求时,都会显示新的时间。

您可以在http://data.stackexchange.com上看到演示..编写查询并运行它,您将看到添加到列表中的时间。