Ajax Action

Hello,

I’m doing a Yii aplication. I have this screen, a permission’s list to assign a role. This works correctly with controller action, but I like that works by ajax, when I click in the on/off slider, run the action within charge the page.

How can I do this?

Thanks

I forget, this is the code that show the on/off slider

<a href="<?PHP echo Url::to([‘seguridad/assign-permiso’,‘rol’=>$model->name,‘permiso’=>$permiso->name]); ?>">

<input data-no-uniform="true" <?PHP echo $checked; ?> type="checkbox" class="iphone-toggle">

</a>

I found the solution and it’s works by ajax.

Thanks for no solution, bad community.

Why don’t you post the solution here for others?

Because this community don’t help

And what have you contributed? You come in here and demand answers and then get upset when nobody answers you within 1 day? Ok.

I think one day is enough time to answer, if someone wants to do

I have not had time to help, but I will if I can

The solution:

<a onclick="$.ajax({type: ‘GET’, url: ‘<?PHP echo Url::to([‘seguridad/assign-permiso’,‘rol’=>$model->name,‘permiso’=>$permiso->name]); ?>’});">

<input data-no-uniform="true" <?PHP echo $checked; ?> type="checkbox" class="iphone-toggle">

</a>