JSFiddle - React, Tailwind, and code Playground
by Dennis Evans
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.min.js"></script>
<div ng-app="app">
<div ng-controller="myController">
<button type="button" ng-click="getDataajax()">GetDataajax</button>
</div>
</div>
JavaScript
console.clear();
angular.module('app', []).value('$', jQuery)
.controller('myController', function ($scope, $http, $timeout, $log, $) {
function wrapper() {
$scope.getEventSeconds();
$timeout(wrapper, 5000);
}
//$http.get('cget.php', {
// params: {
// 'action': 'get_info'
// }
//}).success(function(data) {
// $scope.list = data;
// $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;
//});
$.post("/echo/json/")
//$http.post("/echo/json/")
.success(function (data) {
$log.info("Initial 'get_info' resolved.");
$log.log(data);
});
$timeout(wrapper, 5000);
$scope.getDataajax = function() {
//$http.get('cget.php', {
// params: {
// 'action': 'set_info'
// }
//}).success(function(data) {});
$log.info("getDataajax 'set_info' started.");
$.post("/echo/json/", { delay: 6 })
.success(function (data){
$log.info("getDataajax 'set_info' resolved.");
});
};
$scope.getEventSeconds = function() {
//$http.get('cget.php', {
// params: {
// 'action': 'get_info'
// }
//}).success(function(data) {
// $scope.list = data;
// $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;
//});
$.post("/echo/json/")
.success(function (data){
...