English 中文(简体)
2. 如何确定要求方位[复制]
原标题:How to set request header strings [duplicate]
  • 时间:2011-09-16 21:58:09
  •  标签:
  • ajax
  • jquery

我在一个安全地点拥有丰富的教育服务。 我可以与REST的客户一道,在Porin建立一项要求,但当我试图在法典中建立这一请求时,我获得401份。 我的法典

(function() {
                $.ajax({
                    url : "https://myrestsite",
                    type : "GET",
                    //beforeSend: function (req){
                    //  req.setRequestHeader("Authorization","myauthstring");
                    //  req.setRequestHeader("Content-Type", "application/json");
                    //},                        
                    headers : {
                        "Authorization" : "myauthstring",
                        "Content-Type" :  "application/json",
                    },      
                    success : function (){alert( we got here )}
                });
            })();

这在FF的网络开发工具中显示:

Request-Headers:authorization,content-type

当我需要(来自其他客户是FF)时:

Authorization:myAuthstring
Content-Type:application/json

这对我做什么错了吗?

页: 1 其余客户如何接手?

问题回答

页: 1 选择美元类型

$.ajax({
    ...
    contentType:  application/json 
});




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签