Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AJAX - What content type should have JSON encoded data? [duplicate]

Tags:

html

ajax

php

Possible Duplicate:
The right JSON content type?

Hi

If I send some stuff in a ajax request with json_encode(...) what "Content-type" should I set with header() ? Same like HTML? (text/html)

And does this setting affect the site in any way?

like image 525
Alex Avatar asked Jan 17 '11 20:01

Alex


1 Answers

See What is the correct JSON content type?

The correct content-type is: application/json

like image 105
Dustin Simpson Avatar answered Oct 13 '22 00:10

Dustin Simpson