Wednesday 30 January 2019

Ajax get request not working in safari with HTTPS

I want to load some template files dynamically with the help of ajax. I have added the ajax $.get method for loading the html files and it's working fine with all browsers except safari browser.

In safari it gives me "Failed to load resource: cancelled" error when first time I open the url. However after I refresh my page again, it loads all the files.

When I open my url with http request instead of https, it can load the template file in first time on safari browser.

This issue only happens when I open the url with https. I have successfully installed the certificate and its working fine with other browser. Even there is no certificate issue in safari as well.

Here is my code

var decorator = {
    init: function (book, cd) {
        this.loadTPL(cd);
    },
        tpl: {
        btnStart: "tpl/startBtn.html",
        interfaceTpl: "tpl/interfaceTpl.html",
        topMenu: "tpl/topMenu.html",
        topMenuItem: "tpl/topMenuItem.html",
    },


    loadTPL: function (cbTpl) {
        var self = this;
        var objTpl = {};

        async.forEachOf(this.tpl, function (value, key, callback) {
            $.get(value, {}, function (data) {
                //alert("Load was performed.");
                //console.log(value, data);
                objTpl[key] = data;
                callback();
            });

        }, function (err, results) {
            if (err) {
                console.log(err);
            }
            self.tpl = objTpl;
            cbTpl(err);
        });

    }
}

Any Idea?



from Ajax get request not working in safari with HTTPS

No comments:

Post a Comment