我正在使用JQuery Ajax。
以下是 JQuery代码:
$.ajax({
type: "POST",
url: "http://stackoverflow.com/Login.aspx", // Send the login info to this page
data: str,
success: function(result)
{
//$("#loginDetails").ajaxComplete(function(event, request, settings)
// {
// Show 'Submit' Button
$('#loginButton').show();
// Hide Gif Spinning Rotator
$('#ajaxloading').hide();
var resLength = $.trim(result).length;
if(resLength!=0)
{
var arr = result.split(",");
var fname = arr[0];
var lname = arr[1];
var activeCardNo = arr[2];
var multipleTier = arr[3];
var activeStatus = arr[4];
var access = arr[5];
if(access!='' && access!='undefined') // LOGIN OK?
{
$('.validateTips').hide();
var login_response = '<div id="logged_in">' +
'<div style="width: 350px; float: left; margin-left: 80px;">' +
'<div style="width: 40px; float: left;">' +
'<img style="margin: 22px 0px 10px 0px;" align="absmiddle" src="system/images/ajax-loader.gif">' +
'</div>' +
'<div style="margin: 24px 0px 0px 10px; float: right; width: 300px;">'+
"You are successfully logged in! <br /> Please wait while you're redirected...</div></div>";
$('#loginButton').hide();
$('#closeBtn').hide();
$('#divMember').text(fname +' '+ lname);
$('#spnSkywardsNo').text(activeCardNo);
$('#spnTierStatus').text(multipleTier);
$("#ui-dialog-title-skywardsLogin").text(getDataFromResourceFile('pleaseWait'));
$('#divSuccessLogin').html(login_response);
$('#divSuccessLogin').show();
$('#loginDetails').hide();
//$(this).html(login_response); // Refers to 'status'
// After 3 seconds redirect the
setTimeout(closeDialog, 3000);
}
}
else// ERROR?
{
var login_response = getDataFromResourceFile('InvalidUsername');
$('.validateTips').html(login_response);
}
//});
}
});
如果我要使用 HTTP 请求,上面的代码非常有用,例如,如果我在 http://stackoverflow.com 并且以上呼叫我登录页面即 http://stackoverflow.com/login.aspx 工作正常,但当我选择 HTTPS 请求时 https://stackoverflow.com /login.aspx 然后它正在提供“NS_ERROR_DOM_BAD_URI”,请建议我该如何解决此问题!