Nasip
Nasip

Reputation: 41

Angular POST request

I have developed an web page using Angular JavaScript. Now it working on web API but when i connect to PHP CodeIgniter API, GET function works but POST method is not working. It responds "Response code 405".

Code for userMaintainenceService:

angular.module('commom.services')
 .factory("userMaintainenceService["$resource","appSettings",userMaintainenceSe‌​rvice]); 

function userMaintainenceService($resource,appSettings){
 return $resource(appSettings.serverPath+"dbu/User",null, { 
  Create: { method: 'POST' } 
 });
};

Upvotes: 4

Views: 89

Answers (2)

Jayesh
Jayesh

Reputation: 110

In your comments on question I can see you are trying to make a request on:

{ return $resource(appSettings.serverPath+"dbu/User",null

And in link posted (snapshot) the URL seems to be different:

10.6.1.41/dbu/Test

If you can provide more details like your full controller/service code snippet. It might help to provide a better solution.

Upvotes: 0

shan kulkarni
shan kulkarni

Reputation: 855

code 405 tells that the data you are sending with your request is not compatible with API.

from angular http set the proper type (like" "application/xml", etc)which is allowed at your API

Upvotes: 1

Related Questions