views:

880

answers:

3

I have a script that works fine on my test server (using IIS6). The script processes an ajax request and sends a response with the following line:

header( 'application/javascript' );

But on my live server, this line crashes the page and causes a 500 error.

Do I need to allow PHP to send different MIME types in IIS7? If so, how do I do this? I can't find any way on the interface.

Thanks

+4  A: 

The header is incorrect, try this instead:

header( 'Content-Type: application/javascript' );

Sietse
A: 

the MIME type of javascript files is 'text/javascript'. so the correct php code to send header is:

header('Content-Type: text/javascript');
farzad
A: 

take a look at http://en.wikipedia.org/wiki/Mime_type

There it says you should use application/javascript instead of text/javascript.