I'm building application with angularjs and laravel 4.
Everything is fine but I need now to allow only XHR requests.
This is what I have at the beginning of my controller.
But this statement is always false.
if (!Request::ajax())
{
return Response::json(array('halt'=>Request::ajax()));
};
In angular I'm using standard $http service.
angular.module('APP')
.factory("API", ($http,$q,appClient,apiURL) ->
class FB
constructor:->
this.deferredData = $q.defer();
info: (reload)->
$http(
method: "get"
url: apiURL+'game/'+appClient+"/info"
).success((res)->
dostuff()
)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…