我有一个2字段的表格 用户名: 密码: 和一个提交按钮。 用户将输入他的远程网站(不是我的网站或我的域名,例如Gmail.com)的用户名和密码。 我想要一旦他点击提交按钮。一个jQuery脚本检查这些在gmail.com上的登录信息,并返回result.they是错误或工作登录。并通知用户是否登录错误,但如果登录信息良好,表单将提交。如何使用jQuery检查远程网站的登录信息
我不太了解jQuery,但我很擅长php。我的搜索发现,为了做到这一点,我需要通过在我的jQuery脚本和远程域之间使用php代理来进行跨域脚本编写。 我还发现simple php proxy。这看起来不错。但我不知道如何使jQuery的东西,连接所有这一切。
更新:我发现这个代码,但它不工作。
$('#submitbutton').attr('disabled', true);
$.post('/proxy.php?mode=json&nofollow=1&save_cookies=1&full_status=1&url=https://secure.dooom.com/login/login/',
{
username:$('#Name').val(),
password:$('#Password').val(),
password_strength:"strong"
}, function(data) {
if(data.status.http_code == "301"){
$.get('/proxy.php',
{
mode: 'json',
cookie_file: data.cookie_file,
full_status: 1,
remove_cookies: 1,
//url: 'http://www.dooom.com/store/index/'
url: 'http://www.dooom.com/store/index/?action=add_to_cart&products_id=3263691&is_subscription=1&freq=1&term=getstarted&content=disc99&medium=sales'
}, function(data) {
if(data.contents.search("please sign into") != -1) {
$('#submitbutton').attr('disabled', false);
alert("You must first sign in with this name on dooom before we are able to process this order. Please do so and try again.");
} else if(data.contents.search("first month only") != -1) {
form.submit();
} else {
$('#submitbutton').attr('disabled', false);
alert("You are not eligible for the product. If this is a mistake, click reset form and try again.");
}
}, "json");
} else {
$('#submitbutton').attr('disabled', false);
if(data.contents.search('Too many attempts') != -1) {
alert("You have tried too many attempts, go to dooom.com, logout and log back in doing the captcha");
} else {
alert("Incorrect dooom Username or password");
}
return false;
}
}, "json");
谢谢,但gmail只是一个例子。 – alhoseany 2011-03-12 21:48:36