开发者

Ajax.Request (Prototype v1.6.0.3) not working in Chrome (latest stable Mac version)?

I'm debugging my JavaScript code that runs well in most browsers so far... but Chrome keeps refusing my Ajax.Request at the moment. Please have a look at the following code:

    var base = document.location.pathname.substr(0, document.location.pathname.indexOf('/',1));
    new Ajax.Request(base + '/status.json', {
        method : 'get',
        dataType : 'json',
        contentType : 'application/json',
        onSuccess : function(res) {
            updateProgressBar(res.responseJSON);
        },
        onFailure : function(res) {
            console.error("ProgressBar AJAX failed!");
        },
        onCreate : function(res) {
            console.error("ProgressBar AJAX onCreate!");
        },
        onUninitialized : function(res) {
            console.error("ProgressBar AJAX onUninitialized!");
        },
        onLoading : function(res) {
            console.error("ProgressBar AJAX onLoading!");
        },
        onLoaded : function(res) {
            console.error("ProgressBar AJAX onLoaded!");
        },
        onInteractive : function(res) {
            console.error("ProgressBar AJAX onInteractive!");
        },
        on200 : function(res) {
            console.error("ProgressBar AJAX on200!");
        },
        onComplete : function(res) {
            console.error("ProgressBar AJAX onComplete!");
        }
    });

All those onSomet开发者_Python百科hings have been added for debugging... I normally need onSuccess only. But that is never called by Chrome at the moment. It only fires the following events:

onCreate
onLoading

That's it. No onLoaded or anything else.

Is this a known bug of this version? We use RichFaces v3.3.3.Final which comes with ProtoType. If this simply won't work I'll code my own AJAX Request for Chrome... but I want to make sure that I've not made a simple mistake first. Thanks.

PS: I saw Prototype's Ajax.Request not working in Chrome which is rather old... so I started a new topic.


I'm pretty sure prototype does not have the dataType attribute, try removing that and check again.

Here are the default prototype AJAX options

this.options = {
    method:       'post',
    asynchronous: true,
    contentType:  'application/x-www-form-urlencoded',
    encoding:     'UTF-8',
    parameters:   '',
    evalJSON:     true,
    evalJS:       true
};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜