i want to send multipal ajax request at a time. this is my js code.
Re Check
app.control
I rewrote your controller to use closures in order to make every call asynchronous and keep it DRY.
I tested this and it works, check it out here: http://jsfiddle.net/s6uFx/2/
app.controller('customersCtrl', function ($scope, $http, $timeout) {
function cget(action) {
return $http.get('cget.php', {params: {action: action}});
}
$scope.getDataajax = function () {
cget('set_info')
.success(function (res) {
console.log(JSON.stringify(res));
});
};
$scope.getEventSeconds = function () {
cget('get_info')
.success(function (res) {
console.log(JSON.stringify(res));
$scope.list = res;
$scope.currentPage = 1; //current page
$scope.entryLimit = 10; //max no of items to display in a page
$scope.filteredItems = $scope.list.length; //Initially for no filter
$scope.totalItems = $scope.list.length;
})
.then(function () {
// and start to loop
$timeout($scope.getEventSeconds, 5000);
});
};
// this call replaces the first $http.get and starts the loop
$scope.getEventSeconds();
});