Search code examples
javascriptcontrollerodoo-11

How call a controller from javascript after press a button


I created a controller that returns a pdf, my problem is that I can't recall it from javascript, by pressing the button with the click action.

I have tried with ajax.rpc and rpc.query but to no avail. If I go to the url I can download the file.

Is there any way to get the file that the controller returns?


Solution

  • My solution:

    $.ajax({
        url: url,
        type: 'GET',
        success: function() {
           window.location = url;
     }
    });