开发者

How to tell an ajax request in ruby

IN PHP its like this but in Ruby is how

if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUEST开发者_如何学运维ED_WITH']=="XMLHttpRequest") {
    }else{
        // header("Location: " . base_url());
    }  


There's an xhr? method on the request object that you can use. So in your controller:

request.xhr?

will return true or false depending on whether the request was sent as an XMLHttpRequest.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜