To better illustrate my problem , the question could be:
Can I initiate a session from a JSONP request?
In more detail: Suppose a JSONP request is made from my browser to myserver.com. Can myserver.com set cookies through the JSONP response, so that later on, when requests are again made to myserver.com (either directly when doc.host = myserver.com or indirectly through another JSONP request from an arbitrary doc.host) those cookies will be sent to it? Currently the browser seems to ignore the cookies I send with JSONP responses. Is what I want possible? What am I missing here?
EDIT: This is the request I do , by loading a local js file through a dummy local html that just fetches latest jquery and loads the js file:
$.ajax({
url: "http://my-remote-server/jsonp/service/test",
dataType: 'jsonp',
data: {some:'data'},
success: function(responseData)
{console.log(responseData);}
});
The response of the above JSONP request, is setting a cookie. This is confirmed since chrome reports it. Problem is that if I just re-execute the above a second time, the cookie previously set isnt sent back to the server .
EDIT 2: I went to Chrome cookie browser (in the under-the-hood page) and I cant find the cookie, although it is reported (debug console of chrome) as received in the JSONP response. Which means that server sends it, browser sees it and then throws it away.