Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 包括对$.getJSON的身份验证_Javascript_Jquery_Json_Rest_Getjson - Fatal编程技术网

Javascript 包括对$.getJSON的身份验证

Javascript 包括对$.getJSON的身份验证,javascript,jquery,json,rest,getjson,Javascript,Jquery,Json,Rest,Getjson,我使用以下代码从api获取json数据: $.getJSON( '../propertylocator/api/configurations', function(data) { $.each( data.rows, function(i, rows) { //var homeLatlng= new google.maps.LatLng(0, -180); $('#map_canvas').gmap('addShape', {

我使用以下代码从api获取json数据:

$.getJSON( '../propertylocator/api/configurations', function(data) { 
        $.each( data.rows, function(i, rows) {
            //var homeLatlng= new google.maps.LatLng(0, -180);
            $('#map_canvas').gmap('addShape', { 
                'Polyline': new google.maps.LatLng(rows.latitude, rows.longitude), 
                'bounds': true 
            }).click(function() {
                $('#map_canvas').gmap('openInfoWindow', { 'content': '<strong><a href="detailPage.php?id='+ rows.propertyid +'">'+rows.propertyname+'</a></strong><br/>'+rows.propertyoverview }, this);
        });
});
$.getJSON('../propertylocator/api/configurations',函数(数据){
$.each(data.rows,function(i,rows){
//var homeLatlng=新的google.maps.LatLng(0,-180);
$('#map_canvas').gmap('addShape',{
“多段线”:新的google.maps.LatLng(行.纬度,行.经度),
“界限”:真
})。单击(函数(){
$('map_canvas').gmap('openInfoWindow',{'content':'
'+rows.propertyoverview},这是); }); });
工作很好,但昨天我已经在web应用程序中包含了带有加密密码的基本身份验证,如何在获取json api时包含此代码的身份验证


谢谢

您的问题可能重复的地方还不清楚。您添加了什么样的身份验证?需要在哪一层进行身份验证?页面加载?根据请求?这不是重复的条目我需要知道如何使用$.getJSON模式而不是$.ajax和url参数进行身份验证,我需要将用户名和密码发送到请求。@xzegga
$.getJSON
只是
$.ajax
的代理,预先设置了某些参数。有关传递凭据的详细信息,请参阅