I have some troubles with ajax cross-scripting request using jquery. I'm in a subdomain named test.example.com and i'm doing a ajax call to www.example.com/action like this :
$.ajax({
url:"http://www.example.com/action",
type:"post",
crossDomain:true,
dataType:"jsonp",
jsonp:"cross_domain_action",
xhrFields:{withCredentials:true},
success:function(data){}
});
The problem is that i dont know how to test if the request is an ajax one or not in www.example.com/action.
I'm using CakePHP 1.3 and there is a component call "request_handler.php" with the function
function isAjax() {
return env('HTTP_X_REQUESTED_WITH') === "XMLHttpRequest";
}
I found that there is not that HTTP header in the request.
X-Requested-With XMLHttpRequest
If you have any ideas :) Thanks