0

I am Trying to make an http post request to .php file at the server all what i do is making the request like this

$http({ url: 'http://localhost/sebha/login.php', method: 'POST', params: paramss }).success(function(response) { if (response.pk) { $state.go('tab.home'); } else { console.log('error'); } }); 

but when i trying to receive these parameters at the backend, i could not get them from the $_POST array so when i checked the network in chrome to check the request i found that the Request URL is shown like that however this is a POST request not a get

http://localhost/sebha/login.php?password=admin&username=admin 

i just want to know why the parameters are sent in the URL like exactly a GET request and how i get it work.

1 Answer 1

4

params is for GET requests and will encode the URL - use the data paramter:

 $http({ url: 'http://localhost/sebha/login.php', method: 'POST', data: paramss }).success(function(response) { if (response.pk) { $state.go('tab.home'); } else { console.log('error'); } }); 
Sign up to request clarification or add additional context in comments.

1 Comment

it worked and now i see the parameters in the request payload, but now when i var_dump $_POST in the php file it gives me empty array!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.