Possible Duplicate:
What is the correct JSON content type?
I have problem on json it is only displaying " Content-Type: text/html" I am testing on localhost and my online code is
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/javascript');
//header('Content-type: text/javascript');
//header('Content-type: application/json');
The unofficial MIME type " text/json " or the content-type " text/javascript " are also supported for legacy reasons by many service providers, browsers, servers, web applications, libraries, frameworks, and APIs.
Abstract JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format. It was derived from the ECMAScript Programming Language Standard. JSON defines a small set of formatting rules for the portable representation of structured data.
A media type (also known as a Multipurpose Internet Mail Extensions or MIME type) indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.
use this
header('Content-type: application/json');
for JSON
data
The application/json
Media Type for JavaScript Object Notation (JSON)
header('Content-type: application/json');
chech this from IANA
good read:
Application Media Types
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With