Controller Action Instead Of Some Php File

Hi everyone,

I need help with my js file. I use js file from another not Yii project and it uses api_url to handle some script in php. What I need is to change this script (some php file) to controller action. How can i do this ?

Function in js looks like




	set_api_url: function(url) {

		// set location of upload API script

		this.api_url = url;

	},



and i uses it by




       xxx.set_api_url( 'test.php' );



but i want something like




       xxx.set_api_url( 'controller/action' );



Thanks for any advice.

Well, it should work the same way as you have pointed test.php. Just ensure you’re setting the correct path to the controller action (for eg: PATH_TO_YII/index.php/controller/action).

Since the project is outside Yii, you’ll have to manually set the path - otherwise, you could have used createUrl to assign the path to a var and used that var in your JS file.

Thanks, I dont know why it doesnt work before and now its everything fine. Anyway, Thanks BCR