logo
down
shadow

PHPExcel download using ajax call


PHPExcel download using ajax call

By : user2952003
Date : November 18 2020, 03:49 PM
Hope this helps , add target=_blank in your ajax success function like below
code :
success: function(){
  window.open('http://YOUR_URL','_blank' );
},


Share : facebook icon twitter icon
Using Javascript Ajax call to call MVC action to download object

Using Javascript Ajax call to call MVC action to download object


By : ritesh
Date : March 29 2020, 07:55 AM
With these it helps to @heads5150 for the link.
It was just the fact of setting the browser location with:
code :
document.location.href = "app/GenerateICS?...";
Download a file with an ajax call

Download a file with an ajax call


By : omer khan
Date : March 29 2020, 07:55 AM
I wish this helpful for you Found a way to do this, although I'm not sure if this is an ideal approach.
I added a hidden iframe in the page. When the ajax call returns, it returns the url of the created data. I used javascript to redirect the iframe to that url which automatically triggers the download action.
Download PDF file via ajax call ASP MVC

Download PDF file via ajax call ASP MVC


By : arizona harry
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Don't use Ajax to download a file. It's really tricky you can see it in this question.
It's better to use GET and window.location.href cause file is downloading async anyway.
code :
$('#PrintTimeSheet').click(function () {
   window.location.href = "/Home/DownloadFile";
});

[HttpGet]
public FileResult DownloadFile()
{
   //your generate file code
}
Codeigniter PHPExcel Download via ajax call

Codeigniter PHPExcel Download via ajax call


By : Vega
Date : March 29 2020, 07:55 AM
help you fix your problem I solved my problem by tweaking a little bit of RatHat code answer and this is what saves me:
code :
$('#btnExport').click(function(){
var fdate = $('#dateFrom').val();
var tdate = $('#dateTo').val();
var dept = $('#txtdept').val();
var item = $('#txtsearch3').val();
var form1 = $('#formData1');
var form2 = $('#formData2');

$('#txtdept').val(dept);
$('#txtfdate1').val(fdate);
$('#txtTdate1').val(tdate);

$('#txtItem').val(item);
$('#txtfdate2').val(fdate);
$('#txtTdate2').val(tdate);   



if(fdate == "" || tdate == "")
{
    $('#no-dates').modal('show');
}
else if(fdate == "" && tdate == "")
{
    $('#no-dates').modal('show');
}
else
{
    if(dept != "")
    {
        form1.attr('action',"<?php echo site_url('tms/exportToExcel');?>");
        form1.attr('method','POST');
        form1.submit();
    }
    else if(item != "")
    {
        form2.attr('action',"<?php echo site_url('tms/exportsolo');?>");
        form2.attr('method','POST');
        form2.submit();
    }
}
});
Any way to handle file download from ajax response using CodeIgniter and PHPExcel

Any way to handle file download from ajax response using CodeIgniter and PHPExcel


By : David Quarles
Date : March 29 2020, 07:55 AM
will help you Submitting a form is the best you can do to trigger a file download... It's better to create one even if you don't have a form.
code :
var baseUrl = '<?php echo base_url();?>'

var $form = $(`<form method="post" hidden action="${baseUrl}index.php/Home/excel"><textarea name="queryData">`)
$form.find('textarea').val($("#t").html())
$form.appendTo('body').submit()
fetch(url, {method: 'post', body: data})
.then(res => {
   var cd = res.header.get('Content-Disposition')
   var filename = cd.match(/filename="(.+)"/)[1]

   return res.blob().then(blob => saveAs(blob, filename))
})
Related Posts Related Posts :
  • how to run wordpress php snippet mysql update command from ssh and/ultimately cron
  • how to get xml tag by name
  • ModSecurity maximum post limits (PCRE limit errors)
  • Call controller/action in event listener
  • How to improve performance of contacting WebService?
  • PHP nest variable in echoed string that contains a HTML tag in the end
  • Multiple Ajax request for PHP framework
  • Debug Info from Moodle Plugin
  • passing variables through page
  • Passing PHP $result data to Javascript
  • cakePHP File Download was not found or not readable
  • batch waiting until script finishes
  • PHP variables and anchors in URL
  • php eTag generation using php
  • How to check whether the array is an Integer or Not?
  • Is it possible to install Doctrine without PEAR or Composer? If so, how?
  • Call view script of (parent) Abstract controller Zend
  • Curl PHP cannot display amazon
  • Symfony, getters and setters vs magic methods
  • Using 'continue' PHP instruction outside the loop
  • AJAX POST return data not appearing
  • Can I query relations using an INNER JOIN instead of two queries in Eloquent?
  • Looping through dynamic form fields and inserting into database
  • My php code can't select mysql auto_increment value
  • Store Angularjs form data in database using php
  • I want to run my sh file continuously even if I close my Putty connection
  • file_get_contents equivalent for gzipped files
  • Include PHP file with jQuery
  • php curl headers do not return from website?
  • How to find out, if facebook ID is a user, group or page
  • Connect webhost database to android database
  • preg_match get div content with class
  • Upload multiple files in Laravel 4
  • Count array numbers in multidimensional array
  • PHP Date diff with a difference
  • Search Customer by custom field in Netsuite
  • Is it possible to hide/encode/encrypt php source code and let others have the system?
  • list items to be displayed using php code and array
  • check if row exists mysqli
  • PHP errors loading MySQL
  • setup PostgreSQL with Laravel in MAMP
  • PHP - CodeIgniter Notifications
  • Encrypting a password column in a SQL database
  • New to PHP, trying to extract information from another website
  • JavaScript AmChart to Image for Email
  • Is javascript validation enough to keep my forms secure?
  • Regex extract variables from [shortcode]
  • Download a .mp3 link and save it to computer with PHP
  • Error with the ereg_replace
  • Getting the fields attached to a bundle of an entity in Drupal
  • Php how to check multiple times (within `foreach`) if values from array exists in mysql?
  • MySQL and PHP parsing strange string
  • Pull specific data from multidimensional associative array
  • How to get the original URI extension using PHP Tonic?
  • Upload videos and images from Android to PHP server?
  • Unset a multidimensional array with another multidimensional array with values than key
  • Calling a user e-mail to add to a mailto link PHP
  • Why is override_function coming back as an undefined function
  • PHP mySQLi_fetch_all: iterate through each row
  • Using pow in php
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org