Search code examples
angularjshttp-put

Error when updating json data using http put in angular js?


Why am i getting this

PUT file:///C:/Users/User/Documents/Work/someapi/word/15 net::ERR_FILE_NOT_FOUND when i am updating

$http({
    url: url + Id,
    method: "PUT", //update
    dataType: 'json',
    data: JSON.stringify({
      Id: '154',
      word: $scope.new,
      Date: new Date(),
    }),
    headers: {
      'Content-Type': 'application/JSON'
    }

  })
  .success(function(result) {
    console.log(result);
  })

am not updating a file . am confused.


Solution

  • Please check if URL is valid. make sure you are using http://,https:// in URL