1

I'm trying to make a ajax request to a server php but angular is sending the data as string and there is not $POST in the php (the same works just fine with jquery ajax).

$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);
    });
}

What am i doing wrong?

1 Answer 1

1

Angular is a strange beast :) but i find a fix for this.

enter code here
$http({
        method: 'POST',
        url: "remotecopy.php",
        data: 'url=' + urlData,
        headers: {
            "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
        } ...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.