如何使用jquery进行身份验证?

时间:2012-05-21 05:37:13

标签: jquery

我正在尝试从客户端登录,这是我的代码

$.ajax({
                type: "GET",
                url: "http://150.15.43.10:8002/stream.jpg?jsoncallback=?",
                //data: {},
                //async: true,
                //contentType: "application/jsonp; charset=utf-8",
                //headers: {
                //    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5',
                //    'Accept': '*/*',
                //    'Authorization': 'Basic ' + auth
                //},
                timeout: 500,
                dataType: "jsonp",
                //crossDomain: true,
                beforeSend: function (req) {
                    console.log('Call before send');
                    req.setRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5');
                    req.setRequestHeader('Accept', '*/*');
                    req.setRequestHeader('Authorization', 'Basic Y2FtYmE6Q2FtYmExMjM=');
                },
                success: function (data) {
                    $("#imgLive").attr("src", "http://150.15.43.10:8002/stream.jpg");
                }
            });

但它没有用。 如果你有任何线索,必须回答。

0 个答案:

没有答案