Hello programmers
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
//javascript
$(".print_button").click(function(){
$.get("index.php?r=produtos/addtoprint",function(data){
alert(data);
}).error(function(jqXHR, textStatus, errorThrown) {
alert(errorThrown + "- "+ textStatus + "- "+jqXHR);
});
});
JS;
$this->registerJS($script);
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