【问题标题】:MiniProfiler to profile my ajax requestsMiniProfiler 分析我的 ajax 请求
【发布时间】:2011-12-21 19:41:45
【问题描述】:

如何让 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

【问题讨论】:

    标签: javascript ajax mvc-mini-profiler


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-28
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多