How to change the Content-Type header in a request?

I searched all place and nothing.

Well, I made a ajax request to an action.

I want this action to response with "Content-Type', 'text/javascript;charset=utf-8".

In zend framework I have an example:

$this->getResponse()->setHeader('Content-Type', 'text/javascript;charset=utf-8');

This is because I want execute a javascript that is generated in action.

Yii doesn't have this. You can use PHP function header() directly.

Thank you!

Quote

Yii doesn't have this. You can use PHP function header() directly.

Well… i don't know.

But it doesn't work.

Inside an action I made this:

header('Content-Type', 'text/javascript;charset=utf-8');			


exit;

And it still unaffected!

It's returned: Content-Type: text/html

Is a Yii issue? Can't I overwrite the header for some reason?

Check PHP manual. You didn't use it correctly.

It's too late. I'm tired.

My mistake, sorry.

Wrong sintax:

header('Content-Type:text/javascript;charset=utf-8');

This is because i was doing a lot of array association.

;D

Sorry again!

I Could not undo my mistake in time!!!

;D