extjs下载后隐藏的形式没有解雇成功

Scouring the net for how to separate the download data from the success/fail data when doing a download using a standardsubmit in extjs, and can't find anything specific about how to do this.

For example, I have a hidden form that I am using to force a download:

var hiddenForm = Ext.create('Ext.form.FormPanel', {
    standardSubmit: true,
    height: 0,
    width: 0,
    hidden: true
});

hiddenForm.getForm().submit({
    url: 'downloadtxt.php',
    method: 'POST',
    success: function(form, action) {
        console.log('success');
    },
    failure: function(form, action) {
        console.log('failure');
    }
});

and on the server in PHP I have this code:

$file_name = "test.txt";
$file_data = "The text to save in the file";
header("Content-Type: " . "text/plain");
header("Content-Length: " . strlen($file_data));
header("Content-Disposition: attachment; filename=\"" . $file_name . "\"");
$result["success"] = true;
$result["errors"] = array();
$result["data"] = $file_data;
echo json_encode($result);

In this case, the entire contents of the $result array gets put into the download file (effectively buggering the contents, and additionally the success/fail methods never get called in the submit() code. Now, if I change the PHP server code to:

$file_name = "test.txt";
$file_data = "The text to save in the file";
header("Content-Type: " . "text/plain");
header("Content-Length: " . strlen($file_data));
header("Content-Disposition: attachment; filename=\"" . $file_name . "\"");
echo $file_data;

then the downloaded file contains what I expected ("The text to save in the file"), but the success/fail methods still never get called in the submit() code. How is it possible to trigger the success/fail code, but yet not bugger up the contents of the download file?