I have different html pages, after a user logs in, i have different data been sent back, and i will have to use some of this data together with my next post to a url in another html page. for instance, if a user should log in, if the user is been authenticated, i will get the userid, sex, and some other data to be used in another page, since i have to send everything together with it on the other activity.
Doing something like Bundle or SharedPreferences in JAVA
This is the code for my login page
<script>
var app = angular.module('myapp', [])
app.controller('empcontroller', function($scope, $http){
$scope.insertdata=function(){
console.log("triggered");
$http({
method: 'POST',
url: "myurl",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
transformRequest: function(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
return str.join("&");
},
data: {username: $scope.fname, pswd: $scope.lname}
})
.success(function(data, status, headers, config) {
var mssg = data.MESSAGE;
iqwerty.toast.Toast(mssg);
console.log(data);
if ( data.RESULT === 1) {
window.location.href = 'homes.html';
} else {
$scope.errorMsg = "Login not correct";
}
})
.error(function(data, status, headers, config) {
$scope.errorMsg = 'Unable to submit form';
})
}});</script>
This is the result i get in my console log{"RESULT":1,"MESSAGE":"SUCCESSFUL","EMPID":"2223444"} How can i use my data (that's the result i get as a response after my request has been sent to a given url) in another html page (angularjs controller..which is in another html file). and how can i use this same username in another html page..because, i am to send the username and the EMPID together..in my other html page