Having worked in Jquery and its Ajax for some years, I thought the the internal workings of Angular.JS Ajax call is similar because code looked very similar or no change but I didn’t get the result as expected. Let us see what was the problem and how to resolve it.
Jquery Ajax Call Code
Angular Ajax Call Code (Equivalent of the above)
After looked at the Http Header in the Chrome Inspector, I realised that the Content-Type header passed was missing
Following stack overflow provided me the solution, it said that “You need to include a body with the request. Angular removes the content-type header otherwise”
Modified Angular Ajax Call Code (With dummy body i.e. data : ‘’)
After setting the body, Content-Type was passed and I got my results.