コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2477 ビュー

Hi all. Im getting error in web push notification module. Im trying to send notification but it gives error "Uncaught ReferenceError: XMLHttpRequest is not defined" in service.worker.js.  Here is my code:

function ajax_get(urlcallback) {
    // var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            console.log('responseText:' + xmlhttp.responseText);
            try {
                var data = JSON.parse(xmlhttp.responseText);
            } catch(err) {
                console.log(err.message + " in " + xmlhttp.responseText);
                return;
            }
            callback(data);
        }
    };
アバター
破棄
最善の回答

var ajax = require('web.ajax'); at the begin program

アバター
破棄
関連投稿 返信 ビュー 活動
2
10月 25
1787
3
10月 23
10283
1
9月 23
3843
1
5月 23
2815
2
4月 23
3539