URL的Javascript绝对路径在一个页面上工作,但在另一个页面上创建ajax错误消息
我有两个网址: 当浏览locations页面上的任何属性(以及任何单个属性、使用侧栏过滤属性、从“pullsheet”添加和删除属性)时,jcart.js脚本工作正常——它可以控制从“pullsheet”添加和删除照片 但是,从这个页面中,我得到了以下错误“Ajax错误:编辑jcart.js中的路径以修复” 有关守则是:URL的Javascript绝对路径在一个页面上工作,但在另一个页面上创建ajax错误消息,javascript,url,http-status-code-404,Javascript,Url,Http Status Code 404,我有两个网址: 当浏览locations页面上的任何属性(以及任何单个属性、使用侧栏过滤属性、从“pullsheet”添加和删除属性)时,jcart.js脚本工作正常——它可以控制从“pullsheet”添加和删除照片 但是,从这个页面中,我得到了以下错误“Ajax错误:编辑jcart.js中的路径以修复” 有关守则是: var path = 'https://s140452.gridserver.com/wp-content/themes/re/assets/functions/j
var path = 'https://s140452.gridserver.com/wp-content/themes/re/assets/functions/jcart',
container = $('#jcart'),
token = $('[name=jcartToken]').val(),
tip = $('#jcart-tooltip');
var config = (function() {
var config = null;
$.ajax({
url: path + '/config-loader.php',
data: {
"ajax": "true"
},
dataType: 'json',
async: false,
success: function(response) {
config = response;
},
error: function() {
alert('Ajax error: Edit the path in jcart.js to fix.');
}
});
return config;
}());
脚本如何在locations页面上正常工作,但从其他URL抛出错误?我怎样才能解决这个问题
谢谢
jcart.js位于@使用错误函数,您假设错误只能是不正确的路径。为什么不将函数实现为
error(jqXHR,textStatus,errorshown)
(请参阅),在该函数中设置一个断点,然后找出真正的错误。使用error函数,您假设错误只能是不正确的路径。为什么不将函数实现为error(jqXHR,textStatus,errorshown)
(请参阅),在该函数中设置一个断点,然后找出真正的错误。,因为您遇到了相同的问题。https与http
var path = 'https://s140452.gridserver.com/wp-content/themes/re/assets/functions/jcart',
到
因为你遇到了相同的问题。https与http
var path = 'https://s140452.gridserver.com/wp-content/themes/re/assets/functions/jcart',
到
将该路径写入相对路径的正确方式是什么?将该路径写入相对路径的正确方式是什么?