views:

17

answers:

1

I am working on an application that pulls in information from another one and iframes it in mine. I need to be able to authenticate off the other system.

It was/is working using a jQuery submit to a hidden form, but timing issues are making it tricky.

What I would like to do is an ajax post to the other system and have the cookies set so on ajax completion I can transfer them to another page.

My code currently looks like this:

$(document).ready(function() {
    $.post('Anotherserveronasubdomain.com', {
        username : '<?php echo $username ?>',
        passowrd : '<?php echo $password ?>',
        action : 'logon'
    }, function(data) {
        alert(data);
        //$(location).attr('href', 'apagewiththerightinformationifcookiesareset.php');
    }); 

});

That script doesn't return anything and therefore cookies aren't set. Is there a way to have the remote system set those cookies or am I running in circles here?

Thanks for your time.

A: 

Are you in control of that site on the other subdomain? If the cookies are set with ".domain.com" they will be valid for all sub-domains, and this should work.

Fosco
Cookies on the sub domain are set with .domain.com, they just don't seem to be getting set with this code. It's like I'm missing one step to take the cookie return and set them on the user machine.
Kevin Miles
They should be set by the page you're posting to in the ajax call, and you should not need to do anything with the return.
Fosco
OK, so I'm not crazy and it should work, thanks for the help. I guess it's time to track down the other server admins and see if they have anything to add.
Kevin Miles