0
//A.php
<script type="text/javascript">
$(document).ready(function(e) {
    $('div').load("B.php");
});
</script>

<div></div>

//B.php
<script type="text/javascript" src="B.js"></script>

//B.js
console.log(123);

I have a console error

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience

when I use jquery ajax load another page content external script links

Anyone know how to fix this?

Benjamin W
  • 2,658
  • 7
  • 26
  • 48
  • 1
    That's not the entire code, somewhere you've set `async: false` for all ajax requests, or that's not the ajax request that is throwing the error. – adeneo Feb 05 '17 at 16:45
  • this may be wrong. but can u try this for me? . `$.ajax({ url: "b.php", success: function(data){ $('body').append(data); } });` – plonknimbuzz Feb 05 '17 at 17:20

1 Answers1

1

The script on the other page has set the third parameter of the .open() method of the XMLHttpRequest to false, which makes a synchronous request instead of an asynchronous one. If you have access to the the script, you can set the value to true as long as it doesn't affect the sequence of the scripts rendering. This might also be set inside of a number of jQuery AJAX functions. Check the async property for a boolean (true / false); it would be set to false for this error.

Donnie D'Amato
  • 3,832
  • 1
  • 15
  • 40