Kamil Dąbrowski
Kamil Dąbrowski

Reputation: 1092

Headers file php for ajax for some browsers

Using AJAX to query the server apache (php5) and I saw the difference interpretation for browsers.

I have to rewrite the set to path /ajax/get_category/1 without .txt .json .php etc.

What are the universal solution for all browsers: IE7,8,9, Safari, Chrome, FF etc.?

Looking for solution for json and data.


Can you give examples for ready data $('#content').html(data).

header("Content-Type: text/plain; charset: UTF-8"); ?

Upvotes: 2

Views: 169

Answers (1)

Ryan
Ryan

Reputation: 14649

This will force the browser to not cache the data being requested and it will tell the browser that json data is being sent,

    header('Content-Type: application/json');
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    // Date in the past

Upvotes: 2

Related Questions