2013-01-22 111 views
1

我试图做一个ajax请求到服务器的PHP,但角正在发送数据作为字符串,并没有PHP中的POST(同样的作品很好,与jQuery的Ajax)。角json请求不工作

$scope.getPhotoFromUrl = function() { 
    var urlData = { url: 'http://google.com' }; 

    $http({ 
     method: 'POST', 
     url: "remotecopy.php", 
     data: urlData 
    }).success(function(data, status, headers, config) { 
     console.log('http' + data.url); 
    }); 
} 

我做错了什么?

回答

1

角是一个奇怪的野兽:)但我找到了解决这个问题。

enter code here 
$http({ 
     method: 'POST', 
     url: "remotecopy.php", 
     data: 'url=' + urlData, 
     headers: { 
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" 
     } ...