# Category: http

## angular.js:14525 Error: [$http:baddata] I had a error angular.js:14525 Error: [$http:baddata] Any one Can Help?? if (isset($_GET[‘do’])) {$do = $_GET[‘do’]; print_r($do); switch ($do) { case ‘check’:$this – > check(); break; case ‘getusers’: $data = getusers(); echo$data; break; } } function getusers() { global $con;$query = “SELECT * FROM follow WHERE followby=1”; $result = mysqli_query($con, $query);$rows = array(); while ($r = mysqli_fetch_assoc($result)) { $rows[] =$r; } print_r($rows); return json_encode($rows); //return json_encode($rows); //I tried here […] ## How use$http for loaded page and post data in angularjs

I have a selectbox and in that selectbox whenever the user selects one destination I load a new page inside span with the class name “airlinename” When my function runs I load that page, but it shows the innerhtml instead of showing angularjs that I loaded in that page. How can I loaded page and post data? Here is my first page code: <body ng-app=”myApp” ng-controller=”myCtrl” ng-init=’rcity=[{ “name” : “Moscow”, “id” : 1182348.0 }, { […]

## How to handle HTTP error in the client side?

What is the best way to handle HTTP errors (404, 503, etc.) when submitting a crucial data on the server? Possible solutions I came up with: having the data stored in the session for later submission (data is lost if session expired) have the data downloaded by the user and manually submit it again is it possible to store the data as cookie? Source: AngularJS

## AngularJS callback error and is not a function

I have an error in line callback(response.data) telling that callback is not a function. Well, I am new to this and I am trying to figure out how to fix this issue but I am having a tough time. Any idea is appreciated. Thanks app.service(‘NotificationPollService’, function ($q,$http, $timeout) { var notification = {}; notification.poller = function (callback, error) { return$http.get(‘api/sample.php’).then(function (response) { if (typeof response.data === ‘object’) { callback(response.data); } else { error(response.data); […]

Hello I want to use external API to gather all the current currency rate. My front is based on token and I am storing token in localForage which is nothing but async localStorage. //this execute after every page refresh $localForage.getItem(‘authorization’) .then(function(authData) { if(authData) {$scope.authentication.isAuth = true; \$http.defaults.headers.common.Authorization = ‘Bearer ‘ + authData.token; //set authentication variable to true and add token to every request after page refresh } }, function(){ console.log(“error with getting authorization localForage […]