Is it possible to do an HTTP post request using port number in the url?
This is fine
$http.post('http://localhost/httpPost.json', data);
But this is not working
$http.post('http://localhost:8081/httpPost.json', data);
Yes, it is possible to use the port number in AngularJS request. So the problem is not here.
Could you be a little bit more precise on "not working" ?
Check your browser console (F12 in Chrome, also F12 if you have firebug installed on Firefox). An error message is probably displayed in this console.
I suspect that the Cross-Origin policy prevent you from fetching httpPost.json. It will happens if the call is not made from where you are trying to extract the data (for example if you opened the browser from file system or from another server than the one running on 8081)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With