how to know if the request is ajax in asp.net mvc?

前端 未结 3 1530
孤街浪徒
孤街浪徒 2020-12-02 14:04

anybody how can I know if the request is ajax ? (I\'m using jquery for ajax)

3条回答
  •  广开言路
    2020-12-02 14:31

    It works for me in ASP.NET MVC 3

    if (Request.IsAjaxRequest())
    {
         // ajax request handled
    }
    

提交回复
热议问题