I have 2 (local) subdomains: kohana.local.com
and wordpress.local.com
. jQuery plugin (.js) is located on kohana.local.com domain and takes care of rating articles and retrieving rate count on both domains. Controller_Rating extends Controller. Method (action_getrating) has following code (kohana 3.2):
if($this->request->post() && $this->request->is_ajax()){
$this->auto_render = FALSE;
echo "{$_REQUEST['callback']}(".json_encode($data).")";
}
Ajax call:
$.ajax({
type: "POST",
url: "http://kohana.local.com/rating/getrating",
dataType: "jsonp",
data: { some_id: id },
success: function(json){
//do something
}
});
When ajax call gets issued from kohana.local.com, everything works great. If it's issued from wordpress.local.com $this->request->is_ajax()
is false, and method is not "post", but "get" somehow. What is the reason for this, and how to make it work? Post is required and is_ajax is good for security and validation.
Thanks in advance.
EDIT: post to jsonp is not possible, so i can't use this approach. i'll have to try to find the solution in the direction of json