我試圖從我的login.html,使用javascript,我在login.html將有一個來自MongoDB的驗證從我的account.html。如果它是相同的數據,它應該去acoount.html,但它不是。這是我的javascript:通過javascript移動到其他html
.controller('LoginCtrl', function($scope, $state, $ionicPopup, AuthService) {
$scope.data = {};
$scope.login = function(data) {
var formdata = {
num : $("#num").val(),
pw : $("#pw").val()
};
var Jformdata = JSON.stringify(formdata);
//var url = $location.url();
console.log(Jformdata);
$.ajax({
url : "/ProjectSinarmas/submit",
context : document.body,
type : 'POST',
data : Jformdata,
contentType : "application/json"
}).done(function (response){
//console.log(response);
if(response == "true"){
//$state.go('main.account');
var path = $location.path("http://localhost:8089/ProjectSinarmas/templates/account.html");
alert("Login Success");
}else{
$scope.showAlert('Nomer Telephone dan PIN Salah');
}
});
};
我從我的html這個錯誤響應:
controllers.js:53 Uncaught ReferenceError: $location is not defined
感謝之前,並有一個愉快的一天。
你能顯示響應中的內容嗎? – snit80
@ snit80 controllers.js:53 Uncaught ReferenceError:$ location is not defined –