【发布时间】:2014-11-05 16:56:43
【问题描述】:
我已经包含了所需的文件:
但似乎无法让我的 ajax 帖子提交。似乎该事件在发布之前就停止了。我正在使用 IntelXDK 开发一个应用程序,并且没有很多关于如何使 AJAX 发布工作的详细信息......不知道我错过了什么。有什么想法吗?
我的 ajax:
$.ajax({
url : 'http://xx.xxx.xx.x/check_access.php',
type: 'POST',
data : {'thisusername':thisusername, 'thispassword':thispassword},
dataType: 'Text',
success: function(data, textStatus, jqXHR)
{
if(data==1){
localStorage.setItem("username2", thisusername);
location.assign("./community-home.html");
} else {
function funcError1() {
var iframe5 = document.createElement("IFRAME");
iframe5.setAttribute("src", 'data:text/plain,');
document.documentElement.appendChild(iframe5);
window.frames[0].window.alert('Username or Password does not exist.');
iframe5.parentNode.removeChild(iframe5);
}
funcError1();
}
},
error: function(){
//$("#user-result").html("Username available!");
function funcError() {
var iframe4 = document.createElement("IFRAME");
iframe4.setAttribute("src", 'data:text/plain,');
document.documentElement.appendChild(iframe4);
window.frames[0].window.alert('Something went wrong. Close the application and try again');
iframe4.parentNode.removeChild(iframe4);
}
funcError();
console.log('There was an error');
}
});
return false;
}
【问题讨论】: