简体   繁体   中英

Internet Explorer asks to download POST request as a download

I have inherited a PHP script that does a lot of logic with in-url POST. Once we make the request within IE9, it asks the user for a download of type "true" with a size that closely resembles the POST request. At no point do we see any behavior where the data isn't being saved on the server -- the expected behavior after submit is to simple ask for a download.

The actual POST call is being fired using jQuery.ajax:

$.ajax({
  type: "POST",
  url: "profile/edit-profile-info.php",
  data:"mail="+mail,
  success: function() {
    console.log('Success!!!');
    location.reload('true'); //Reloads the page with the form
  }
}).done(function() {
    console.log('Done!!!');
    location.reload('true'); //Reloads the page with the form
});

And the reload command is inherited within the browser object space, from what I can tell.

The actual PHP script that handles this data essentially saves the data in an ORM (not in the code) and returns a request as text/plain

header('Content-Type: text/plain; charset=utf-8');
$data->record->mail = $_POST['mail'];

We tried sending another Content Type as a request and it fails to function in Chrome, Firefox, et al.

Looking at the inherited HTML, the fields are populated in a hierarchy without a form tag, which gives me pause as to that being the cause. I'm not entirely sure if that's a culprit. Unfortunately I can't readily give out a demo for review. But if anyone has seen this or has any ideas on the cause, insight would be appreciated.

Remove the commas around true in location.reload('true'); it requires a boolean and your inputting it as a string which is not what IE is expecting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM