1
I have an application that returns JSON content from PHP to an HTML page, but I do this without defining the header
, such as, for example : header('Content-Type: application/json');
, that is, in the application has no such statement.
Works normally, the browser can normally manipulate JSON with Javascript.
But one day I decided to define the header
and when calling the content directly through the URL I realized that the content on the page, the source of the text, gets smaller when defining the header
passing in the Content-Type
the value application/json
comparing if it had not defined the same or with the Content-Type
displaying a different value, as if to return an HTML for example header('Content-Type: text/html; charset=utf-8');
.
From this I would like to know. What is the difference in defining the header
or not in a PHP application? There is some performance increase defining the header
since the text changed to a different font and style when the content was JSON? Why this difference with the way the content is displayed on the screen?
How the requisition was made?
– Felippe Tadeu
With GET and passing a small value in the parameter to identify the method to be called. But wanted to know about this difference.
– Giancarlo Abel Giulian
Solved your doubt?
– durtto
Still unresolved, you’re also curious to know?
– Giancarlo Abel Giulian