Prototype AJAX request being sent as OPTIONS rather than GET; results in 501 error

后端 未结 4 1327
情歌与酒
情歌与酒 2020-11-30 09:14

I\'m attempting to access a web service with Prototype/AJAX and am running into an error I can\'t figure out: it seems that when I make a request to a server my request is i

4条回答
  •  执笔经年
    2020-11-30 09:56

    Actually, it's much easier with Prototype.js V1.7:

    Ajax.Responders.register({
        onCreate:function(r){
            r.options.requestHeaders={
            'X-Prototype-Version':null,
            'X-Requested-With':null
            };
        }
    });
    

    Prototype.js drops any pre-defined header if its value is null.

提交回复
热议问题