I am trying to login to another site remotely through jquery. I have set up a link on my site that will run my js file. My question is how do I either redirect my page or open a new browser window that will access the remote login page? The remote login page will accept the username and password as hidden fields. The username and password are being passed into my script from my drupal page.
Would I use the $.post function as shown below (although this doesn't work) or is there another way?
if( Drupal.jsEnabled){
$(document).ready(function(){
$('a.logon_to_abc').click(function(){
var GetData = function( data ){
var result = Drupal.parseJson(data);
$.post("https://www.abc.com/Login.aspx", { UserID: result['UserID'], PWD: result['PWD']},
function (){
alert("works");
} );
}
$.get(this.href, null, GetData );
return false;
});
});
}
Thanks..
Comments
Some reading for ya...
http://www.w3.org/TR/access-control/
http://developer.yahoo.com/javascript/howto-proxy.html
http://ejohn.org/blog/cross-site-xmlhttprequest/
http://developer.mozilla.org/en/docs/Cross-Site_XMLHttpRequest
Cross-site XHR requests are usually a no-no. You'll most likely need a local proxy.