我有一个项目,当我使用MAMP运行时一切正常。但是当我在括号中运行时,它会抛出错误
无法发布/b.html?xx=yy ....
HTML:
<form id="emailForm" action="b.html" method="POST">
<input id="emailModal" type="email" name="email" placeholder="Email" required class="form-control input-lg" value=""></input>
</form>
JS: Estafunciónconnierteun objeto en una listadeparámetros。
function objToParams(infoUserShow){
var str = "";
for (var key in infoUserShow) {
if (str != "") {
str += "&";
}
str += key + "=" + encodeURIComponent(infoUserShow[key]);
}
return str;
}
这是对象:
var infoUserShow = {
nickname : eventObj.user.nickname
,loginProvider : eventObj.user.loginProvider
,photoURL : eventObj.user.photoURL
,country : eventObj.user.country
,isLogged : false
}
console.log(objToParams(infoUserShow));
在这里我们提交给 //电子邮件存在验证 var userMail = eventObj.user.email; if(!userMail){
//We customize the modal header for the customer
document.getElementById('customMsg').innerHTML = "Hey " + infoUserShow.nickname + "!";
$('#myModal').modal({
backdrop: 'static',
keyboard: false
});
$('#myModal').modal('show');
}else{
//set user as logged
infoUserShow.isLogged = true;
//Add + 1 session to the cookie
setAddCookie();
//ADD parameters infoUserShow to the URL
emailForm.action = "b.html" + objToParams(infoUserShow);
emailForm.submit();
}
$('#Cancel').click(function() {
$('#myModal').modal('hide');
});
$('#Confirm').click(function() {
var emailValidation = true; //data entered is correct
if(emailValidation){
//set user as logged
infoUserShow.isLogged = true;
//Add + 1 session to the cookie
setAddCookie();
//ADD parameters infoUserShow to the URL
emailForm.action = "b.html?" + objToParams(infoUserShow);
emailForm.submit();
}
});