กด download แล้วไม่ไปหน้าที่เราจะทำ download ไฟล์
Posted: 13/01/2021 7:13 pm
ทำกดปุ่ม download แล้วให้เด้งไปที่ไฟล์ exportimg_crop.php แต่พอกดเด้งไปแล้วไม่ยอมไปที่ไฟล์ exportimg_crop.php ต้องทำอย่างไรค่ะ
มันเด้งหน้าใหม่แต่ขึ้น Object not found! ไม่ไปหน้า exportimg_crop.php ไฟล์ script.js
ไฟล์ exportimg_crop.php
มันเด้งหน้าใหม่แต่ขึ้น Object not found! ไม่ไปหน้า exportimg_crop.php ไฟล์ script.js
Code: Select all
$(document).on('click','.btn_downcrop',function () { //----คลิ๊กมาจากปุ่ม download
var input=$(this).closest('.row').find('.cropbe4 input');
var data = {};
$.each(input, function() {
var name=String($(this).attr('name')).replace('[]','');
data[name]=$(this).val();
});
//-------ส่วนที่จะเด้งไปหน้าสำหรับทำตัว download ไฟล์
$.post('exportimg_crop.php', {'file':'123'}, function (result) {
window.open(result.id, '_blank');
});
});
Code: Select all
<?php
header('Content-type: application/json');
echo '{"status":"success","id":"222"}';
exit;
?>