javascript - Un-Defined index with $http. -
not sure reason got undefined index below code. checked can't find what's wrong.
$http({ url: "php/mainload.php", method: "get", data: {"userid":"1"} }).success(function(data, status, headers, config) { console.log(data); }).error(function(data, status, headers, config) { // $scope.status = status; alert(status); });
php
echo $_get['userid'];
parametere data
on ajax expecting method post
, if need $_get
, use params
instead :
$http({ url: "php/mainload.php", method: "get", params: {"userid":"1"} // change `params` `data`. }).success(function(data, status, headers, config) { console.log(data); }).error(function(data, status, headers, config) { // $scope.status = status; alert(status); });
Comments
Post a Comment