0

I have on a page a option value that displays the image resolution, the option content is extracted with php from db.

My question is. How can i make the jquery on button click to download the image and not open in a new window.

My jquery code is:

$(document).ready(function (){
    $('#download-btn').click(function(){
        var size = $('#size').val();                
        window.open(size);
    });
})

My php select option drop down is:

<div class="download-bar">
    <div class="selecter-container">
        <select id="size" name="selecter_basic" class="selecter_basic" data-selecter-options='{"defaultLabel":"SELECT SIZE"}'>
            <?php foreach ($w->sizes as $s) { echo "
            <option value=\ "".M_ENV_SITE_URL. "/img/".$s. "_".$w->filename."\">".$s."</option>"; } ?>
        </select>
    </div>
    <button type="submit" id="download-btn" class="btn-40-2-download btn-float-right"><i class="fa fa-cloud-download"></i>
    </button>
</div>
Dhaval Marthak
  • 17,246
  • 6
  • 46
  • 68
Bogdan Crișu
  • 53
  • 1
  • 1
  • 9

0 Answers0