my angularjs $http
userId = '1';
$http({
url: "php/loadTab.php",
method: "POST",
data: userId
}).success(function(data, status, headers, config) {
console.log(data);
}).error(function(data, status, headers, config) {
});
heck, POST doesn't send the data to my php. I do echo $_POST['userId'] it returned undefined index. I also tried data:'userId':'1'
data:{'userId':'1'}?$httpsends data as JSON, that's why there is nothing in PHP's$_POST. There numerous similar questions here on SO.