5

I am getting json data from api with this code:

$.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);
        });
});

Work fine, but yesterday I has included basic authentication with encrypted password to the web app, how I can include authentication to this code to authenticate when get json api?

Thanks

xzegga
  • 3,051
  • 3
  • 25
  • 45
  • 2
    possible duplicate of [How to use Basic Auth and Jquery and Ajax](http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-and-jquery-and-ajax) – Felix Kling Sep 30 '13 at 00:46
  • Your question is more than unclear. What kind of authentication did you add? At what layer does the authentication need to be made? Page load? on request? – Ohgodwhy Sep 30 '13 at 00:46
  • It's not duplicate entry I need to know how I can authenticate using $.getJSON mode not with $.ajax with url param, I need to send it a username and password to the request. – xzegga Sep 30 '13 at 00:50
  • 1
    @xzegga `$.getJSON` is just a proxy to `$.ajax` with certain parameters pre-set. See the [second answer](http://stackoverflow.com/a/11960692/283366) for details on passing credentials – Phil Sep 30 '13 at 00:55

0 Answers0