1

Errors

I have a problem with using data of a json file in my html document.

At the top you can see the errors that i get.

I have this file created as a json file New.json :

[
    { "firstname":"Thomas", "lastname":"Anderson" },
    { "firstname":"Agent", "lastname":"Smith" },
    { "firstname":"Agent", "lastname":"Brown" }
]

I tried this code to get the data from my json file

    <script type="application/javascript">
            $(document).ready(function() {
                $("div").click(function () {
                    $.ajax({
                        type: 'GET',
                        url: './New.json',
                        dataType: 'json',
                        success: function(data){
                            window.alert(data);
                        },
                    });
                });
            });
    </script>

Thanks for your help :)

Deniz
  • 11
  • 3

1 Answers1

0

You URL might need to be: url: './New.json',

Matt Laszcz
  • 373
  • 3
  • 20