Download file using ajax GET request

Download file using ajax GET request

Hi,
I'm trying to downloading a file using ajax GET reques, but nothig happens

This is the code:
$.ajax({
      url: "downloadAvviso.php",
      type: "GET",
      dataType: 'binary',
       
      success: function(result) {
        var url = URL.createObjectURL(result);
        var $a = $('<a />', {
          'href': url,
          'download': arg1,
          'text': "click"
        }).hide().appendTo("body")[0].click();

        URL.revokeObjectURL(url);
      }
    });

where arg1 is the name of the file to download and arg3 the server directory
Please, Can someone helps me?

Thanks in advance
Tegatti