我正在尝试将json
数据发送Http headers
到服务器
App.LoginController = Ember.ObjectController.extend(
{
username: '',
password: '',
actions: {
login: function(){
username = this.get('username');
password = this.get('password');
// alert("User: "+ username + " Pass: " + password);
var loginData = {"code":username, "passkey":password};
loginData = JSON.stringify(loginData);
// alert(loginData);
var timeStamp = getTimeStamp();
// alert(timeStamp);
$.ajax({
url: 'http://192.168.254.222:8080/project/auth/login',
type: 'POST',
beforeSend: function (request)
{
request.setRequestHeader("token", authToken);
},
data: loginData,
dataType: 'json',
contentType: 'application/json',
success: function(data) {
var returned_data = data;
console.log(returned_data);
console.log(returned_data.error);
alert('yey!');
},
error: function(xhr, status, error){
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
}
});
}
}
});
- 但变量
err
返回undefined。 - 另外我不确定如何将多个发送
HttpRequest headers
到服务器,同时获取HttpReponse headers
. - 铬给了我这个:
拒绝加载 chrome-extension://nhjloagockgobfpopemejpgjjechcpfd/js/jquery.min.map。资源必须列在 web_accessible_resources 清单键中,才能被扩展之外的页面加载。本地主机/webui/:
获取 chrome-extension://invalid/
除了这些,我在 Firefox 中没有收到任何错误消息