Send JSON data with Post Method in Ajax can not read the value By $_POST in PHP

When we are Working in Ajax, Some times we have to send data to server json format or

 



Case 1:
addsome.php

In this case we are using $_POST as Data Holder.

Out put:-

 



 

 

Case 2:



In this case php://input as data holder
addsome.php

Out put:-

What is the Reason and why $_POST not working



The reason is that php://input returns all the raw data after the HTTP-headers of the request, It does not required any content type
however, $_POST method required content type like
1) application/x-www-form-urlencoded
2) multipart/form-data