DoersGuild/jQuery.print

$(...).print is not a function

Closed this issue · 1 comments

Expected behaviour

click a button and print something

Observed behaviour

[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
index.php:176 Uncaught TypeError: $(...).print is not a function

Steps to reproduce the issue

 function _getTableView(id) {
        $.ajax({
            url: 'index.php?act=net_examine&op=getTableView',
            data: {form_submit:'ok',id:id},
            type: 'POST',
            dataType: 'html'
            success: function (info) {
                       $("#print_div").html(info);
                       $("#print_div").show();
                       $("#print_div").print({iframe:true,prepend:'<br/>'});
                        $("#print_div").hide();
                        $("#print_div").html('');
            }
        });
    }

Simplified demo link reproducing the issue

XXX

jQuery, jQuery.print version

/*! jQuery v1.8.2 jquery.com | jquery.org/license */
jQuery.print, version 1.5.1

Browser and operating system

chrome 67.0.3396.99 64

It appears the print plugin was not loaded/imported for some reason
This can happen if you are loading another instance of jQuery after loading jQuery.print or if an error occurred while loading it in the first place (which would show up on your console)
Kindly re-check your code flow and create a simplified demo showing the issue for us to help you