2012-09-30 3 views
5

Mögliche Duplizieren:
The right JSON content type?der richtige MIME-Typ für JSON?

ich habe Problem auf json es nur angezeigt wird "Content-Type: text/html" Ich teste auf localhost und mein Online-Code ist

header('Access-Control-Allow-Origin: *'); 

header('Content-Type: application/javascript'); 
//header('Content-type: text/javascript'); 
//header('Content-type: application/json'); 
+0

Warum verwenden Sie nicht 'application/json'? – think123

+0

letzte Zeile auskommentieren – diEcho

+2

[Duplizieren] (http://Stackoverflow.com/q/477816/1077789) – Isuru

Antwort

1

Der application/json Medientyp für JavaScript Object Notation (JSON)

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

chech dies von IANA

gut zu lesen:

Application Media Types

3

Verwendung dieses

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

für JSON Daten

+0

es funktioniert nicht – user1709424

+0

@ user1709424 können Sie etwas Code ?? –

1

Der MIME-Typ für JSON ist application/json

Verwandte Themen