search

Home  >  Q&A  >  body text

javascript - ajax request JSON file, personal virtual host is ok, company server reports error 404 JSON file not found

1. As in the title

JS part

<script>
    $(function(){
        $.ajax({
            url:'test.json',
            type:'get',
            dataType:'json',
            success:function(data){
                console.log(data)
            }
        })
    })
</script>

Browser console error reporting part
GET http://www.siemensgabor.com/t... 404 (Not Found)
Sometimes this is the error message:
Failed to load resource : the server responded with a status of 404 (Not Found)

Note: The location of the JSON file is definitely correct, and there is no problem with hosting your own website on the virtual host

阿神阿神2749 days ago478

reply all(3)I'll reply

  • 迷茫

    迷茫2017-05-19 10:18:29

    There is no direct access from the browser...

    The problem should be with your company’s server.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-19 10:18:29

    It may also be due to the LAN. You and your virtual machine are on the same LAN, but you are no longer on the same LAN as the company.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:18:29

    Try requesting to write an absolute path

    reply
    0
  • Cancelreply