My question is, how to send a cookie with setRequestHeader. My code to test this is:
var client = new XMLHttpRequest (); Client.open ('post', 'url'); Client.setRequestHeader ('cookie', 'test = mycookie'); Client.setRequestHeader ('cookie', 'test = mycookie'); Warning ("start"); Client.onreadystatechange = function (if (client.readyState == 4 & client.status == 200} {alert ("start"); warning (client.getAllResponseHeaders ()); Document.getElementById ('test' ) InnerHTML = client.responseText; Alert ("end");}} Client.send (); getAllResponseHeaders () - The method gives only the context type but how can I see Is that cookie set or not?
So it should be javascript and documented. There is no way to cookie, because I develop Nokia for WTT and do not use it
XMLHttpRequest designed to do this Was it not that your saying to do this as you tell in the right way that cookies are a common way of setting cookies in JavaScript, it really means to make a cookie request this way through AJAX
If you can not use document.cookie, then post your cookie parameters To have the data and set a cookie in response to your server side Hanndlr.
For example, if your server-side handler was a Java servlet:
cookie myCookie = new cookie ("name", "value"); HttpServletResponse Res = getContext (). GetResponse () AddCookie (myCookie);
Comments
Post a Comment