0

If I set the ajax format to x-www-form-urlencoded I can easily access the sent data in the $_POST['whateverinput'] global, but if I use JSON it will introduce another problem of having to convert it back to a usable format to PHP with

$_POST = json_decode(file_get_contents('php://input'), true);

Why bother with JSON to transmit data from AJAX?

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • JSON is a convenient format for sending lot's of data in an efficient way and every language has a way of dealing with JSON in a way that makes sense. – Jay Blanchard Feb 13 '17 at 17:48
  • Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. You may want to find a development forum (perhaps [quora](http://www.quora.com/Computer-Programming)?) to work out generalities. Then, when/if you have specific coding issues, come back to StackOverflow and we'll be glad to help. – Jay Blanchard Feb 13 '17 at 17:48

0 Answers0