7

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');
Sandra Rossi
  • 9,036
  • 2
  • 18
  • 39
user1709424
  • 71
  • 1
  • 2

3 Answers3

3

use this

header('Content-type: application/json');

for JSON data

Yogesh Suthar
  • 29,554
  • 17
  • 66
  • 96
1

The application/json Media Type for JavaScript Object Notation (JSON)

header('Content-type: application/json');

chech this from IANA

good read:

Application Media Types

Database_Query
  • 586
  • 3
  • 14
1

The MIME type for JSON is application/json

Isuru
  • 27,485
  • 56
  • 174
  • 278