It is a simple ajax cross-domain value transfer, using the relative path code as follows:
//这里我没有做浏览器判断
var url ="../Qiniu/changeMysql.php";
console.log(URL);
$.ajax({
url:url,
type:'POST',
data:{'randomName':randomName,'id':id},
dataType:'JSON',
success:function(res){}
)};
But my file directory is like this
vtour_background----Qiniu------------changeMysql.php
|
---BackgroudHTML---indextest.html(为浏览器运行页面,引用changepictures.js)
|
---scripts ----------------changepictures.js
The above code is that the relative path of the chrome browser in changepictures.js is not based on the current js? The url should be "../../Qiniu/changeMysql.php", but now I can use the above url to pass the value correctly. do not know why. Could you guys help me out or tell me how to check this error? Thank you very much~
应该是相对于js文件被引入的html文件,和js文件所在路径无关.