call ajax method from another model?

I’m being a bit dense, how do I call an ajax method thats in another model?

I’m guessing its something to do with the “url: $(this).attr(‘href’),” but I’m not sure what to put in there?

In protected -> event -> view -> admin.php I have

Yii::app()->clientScript->registerScript('ajaxpaid', "

$('#event-client-grid a.ajaxpaid').live('click', function() {

        $.fn.yiiGridView.update('event-client-grid', {

                type: 'POST',

                url: $(this).attr('href'),

                success: function() {




        return false;



The ajaxpaid method is in protected -> controllers -> eventclientcontroller.php

public function actionAjaxPaid($id,$client_id=null,$event_id=null)


	// Do something with client_id and event_id


	$model->paid = (!$model->paid);

	$model->payment = $model->event->fee;



I would argue that the method doesnt belong in your model.

Create an AJAX controller, call a method in there which loads the model and does the work.

Got it to work by duplicating the ajax function code into the event model - not ideal but it works :)

Ah right…

Can you give me an idea how I would create an ajax controller?

Thanks, Russ