Is it possible to set a cookie with ajax?

I can successfully post to the script but the cookie doesn't get set. Is there any known pitfalls regarding this?

Thanks!

    your HTML page can make an AJAX call to a PHP page which sets a cookie. the command in PHP is [man]setcookie[/man]. I'm not sure if this will result in your HTML page immediately recognizing the new cookies. It may be that Javascript defines the document.cookie object only when your page gets loaded the first time. You should probably return a result from your AJAX call as well.

      Write a Reply...