0

I've seen this resolved within the AJAX call itself, unfortunately, I'm not using the AJAX call.

I have a series of buttons that are toggling a Bootstrap modal, and plugging a URL and a parameter into the modal. Everything loads just fine, I'm just getting the Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. Warning.

I know that if I were to set async to TRUE, all of this would go away, but I'm loading in all of my content through Bootstrap's shown.bs.modal

HTML

<a data-remote="false" data-toggle="modal" data-target="#playbackPlus" href="player.jsp?track=songFile.mp3">Launch Modal</a>

<div class="modal fade" id="playbackPlus" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content playbackplus">

        <%-- MODAL BODY START --%>
        <div class="modal-body">
        </div>
        <%-- MODAL BODY END --%>
    </div>
  </div>
</div>

JS

$('#playbackPlus').on('shown.bs.modal', function(e) {
     var link = $(e.relatedTarget);
     $(this).find(".modal-body").load(link.attr("href"));
});

Where/How do I get rid of the Sychronous XMLHttp Warning?

Murphy1976
  • 1,415
  • 8
  • 40
  • 88
  • 1
    What version of jQuery are you using, and does the page behind the link provide a `script` tag in it? See a similar question here: [Synchronous XMLHttpRequest warning and <script>](http://stackoverflow.com/q/28322636/215552) – Heretic Monkey Nov 16 '16 at 21:42
  • I am using jQuery version 2.1.3. As for the player.jsp page, it does contain a few external js scripts, all of which have async set to async, or to true (I've tried both). I still get the warning message. – Murphy1976 Nov 16 '16 at 21:46
  • Did you read that link? The accepted answer says in was fixed in jQuery 3.0, and provides a workaround. – Heretic Monkey Nov 16 '16 at 21:48

0 Answers0