0

I made an application using ajax in some points, and I figured out that it wasn't working on IE and EDGE. On the examples bellow, I'm trying to generate a PDF from one html page. Here's my code

$(document).ready(function() {
  try {
  var url_string = window.location.href;
  var url = new URL(url_string);
  var token = url.searchParams.get("token");

  if (url_string.includes('/quiz/show_report')) {
    $.ajax({
      cache: false,
      type: "POST",
      url: '/chart.js?token=' + token
    });
  }
 } catch (e) {}
});

on the document, I'm calling

$.ajax({
  cache: false,
  type: "POST",
  url: '/download_pdf?token=' + token,
  data: {
    natural_chart: $('#natural-chart').attr('data-image'),
    humanities_chart: $('#humanities-chart').attr('data-image'),
    language_codes_chart: $('#language-codes-chart').attr('data-image'),
    mathematics_technology_chart: $('#mathematics-technology-chart').attr('data-image')
  }
}).success(function(e) {
  window.location = '/download?token=' + token;
});

What I tryed: Using cache false Forcing ie compatibility mode with that metatag:

<meta http-equiv="X-UA-Compatible" content="IE=7" />

and that:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" >

and all that other compatible meta tags. I Tryed also that ones

<meta content="no-cache" http-equiv="Cache-Control"> <meta content="no-cache" http-equiv="Pragma">

We updated the jquery version to the newer one (3.2.1),

Anyone has any idea what I might do to fix it?

Thank you in advance

  • Hmm.. I think this problem is same of mine maybe. Are you testing this in local host?? – Canet Robern Oct 24 '17 at 07:30
  • I just tested on staging. Aparently it's a problem with ajax and iframes. Are you using iframe too? – Rachel Curioso Oct 24 '17 at 21:32
  • Someone recommended that but I didn't try that. https://stackoverflow.com/questions/45747418/with-angularjs-http-post-return-response-error-in-microsoft-edge This post is my question that is similar with your problem. Very soon, I'll test it not in local, so I expect can get result whether my conclusion is right or not. – Canet Robern Oct 25 '17 at 00:12
  • I tested this problem on local, on staging and on production and it didn't worked ): – Rachel Curioso Oct 26 '17 at 12:23
  • Really?? Then this is a big problem to me.. I'll try to find another solution and if I got one which works well, I'll share that with you. – Canet Robern Oct 27 '17 at 00:46
  • I brought several suggested solutions. Some of these might you've already seen but I hope one of these can help you. 1. https://stackoverflow.com/questions/17547227/angular-js-post-request-not-sending-json-data 2. https://stackoverflow.com/questions/45463284/angulars-http-post-not-working-in-ms-edge 3. https://stackoverflow.com/questions/32581503/microsoft-edge-blocked-cross-domain-requests-sent-to-ips-in-same-private-network 4. https://tutorialedge.net/javascript/angularjs/interacting-with-apis-using-http-angularjs/ – Canet Robern Oct 27 '17 at 07:30
  • And also I've found a weird action in edge. I've used `$http()` method in my project and this is never send request to server. I don't know why but after I changed function like `$http.post()`, then send something but couldn't get correct response from server. This is all I've gotten – Canet Robern Oct 27 '17 at 07:35
  • I'll try that! But we decided to drop the funcionality that needed ajax on IE and edge – Rachel Curioso Oct 27 '17 at 18:50
  • LOL sadly, we also reached same conclusion of yours. Maybe this might be a bug in MS browsers. Good luck to you. :) – Canet Robern Oct 28 '17 at 07:29
  • @RachelCurioso I'm having the same problem, did you ever find a solution to this? Any help would be greatly appreciated! – susieloo_ Apr 08 '18 at 04:30

1 Answers1

0

Do you have any information about why it can not work at EDGE? As I know, EDGE did not support "searchParams" right now.

James Wu
  • 21
  • 5
  • I don't know ): All that I know is that we have anotter application that AJAX work fine with EDGE, So, I don't have a clue ): – Rachel Curioso Nov 19 '17 at 15:06