call function control javascript

Hello programmers :slight_smile:

I want call a function controller whit javascript

I have in my controller de function:

public function actionAddtoprint(){

        echo "Hello";



in my view i have de script:

$script = <<< JS





    }).error(function(jqXHR, textStatus, errorThrown) {

        alert(errorThrown + "- "+ textStatus + "- "+jqXHR);






when i click de button that call de javascript apper de alert erro with text: - error- [object Object].

i think nah the get don´t call de url, why?

Thanks for your help