Hello, Community!
My question is about how external reference to files works in an external JavaScript file. I explain!
Suppose I have three files: index.php
, json.php
and javascript.js
with the following structure
/
index.php
js/
javascript.js
data/
json.php
The JavaScript file has the following code, referencing the file json.php
:
$.getJSON( "../data/json.php", function( data ) {
//faz alguma coisa aqui
});
Now, if I include the JavaScript file in the index.php
file, the reference to the json.php
file gets lost, although the relative reference in the .JS
file is technically correct.
How can this be explained?