1

The download image button on my website is not working.

This is the jQuery code:

$("#download").click(function () {
    var img = $('#link').val();
    $.ajax({
        url: 'img.php',
        type: 'post',
        data: '',
        success: function (data, textStatus, jQxhr) {
            console.log(data);
            document.location.href = "data:image/jpg;base64," + data;
        },
        error: function (jqXhr, textStatus, errorThrown) {
            console.log(errorThrown);
        }
    });
});
Janak
  • 4,986
  • 4
  • 27
  • 45
Med Naim
  • 21
  • 3
  • 2
    Please refer this link. Hope, It will help. (https://stackoverflow.com/questions/17657184/using-jquerys-ajax-method-to-retrieve-images-as-a-blob) – jawahar N Sep 28 '18 at 03:55

0 Answers0