0

I have this below code where I am trying to retrieve data from external url. I am getting 401- unauthorized access error when I try to do this. Please Advice

<script type='text/javascript'>



    function checkBlueLight() {

        $('#trBlueLight').hide();

        $.getJSON('http://.../Lights/getBlueLight?callback=?', function (data) {
            if (data.expDate != null) {
                $('#trBlueLight').show();
            } else {
                $('#trBlueLight').hide();
            }
        });
        }



    </script>
itdeveloper
  • 41
  • 2
  • 8

1 Answers1

0

Try to use $.ajax instead:

$.ajax({
    url: 'http://.../Lights/getBlueLight',
    dataType: 'json',
    success: function(data) {
       if (data.expDate != null) {
           $('#trBlueLight').show();
       } else {
           $('#trBlueLight').hide();
       }
    }
});  
Eli
  • 14,779
  • 5
  • 59
  • 77