我不知道如何调试目前这个特定的问题。从脚本调试404错误页面加载Fancybox
例如,如果您查看此category page例如并点击顶级产品上的“购买”按钮,将出现一个弹出窗口,点击“继续结帐”按钮,Fancybox模式会短暂显示404错误 - 是否有人友好地使用他们的浏览器开发工具,并指出为什么它加载Fancybox模式内的404错误页面?
是控制这已经成为一个有点乱,但我在下面提供以供参考的脚本...
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery('.fancybox').fancybox(
{
hideOnContentClick : true,
width: 382,
autoDimensions: true,
type : 'iframe',
showTitle: false,
scrolling: 'no',
onComplete: function(){
jQuery('#fancybox-frame').load(function() { // wait for frame to load and then gets it's height
jQuery('.fancybox').height(jQuery(this).contents().find('body').height()+30);
jQuery.fancybox.resize();
});
}
}
);
});
function showOptions(id){
jQuery('#fancybox'+id).trigger('click'); //show the custom options on click if they exist
}
function setAjaxData(data,iframe){
if(data.status == 'ERROR'){
alert(data.message); //show error message if nothing to update
}else{
if(jQuery('.block-cart')){
jQuery('.block-cart').replaceWith(data.sidebar); //otherwise update the cart in the sidebar block
}
if(jQuery('.header .links')){
jQuery('.header .links').replaceWith(data.toplink); //otherwise update the cart in the header block
}
jQuery.fancybox.close();
}
}
function setLocationAjax(url,id){
url += 'isAjax/1';
url = url.replace("checkout/cart","ajax/index");
jQuery('#ajax_loader'+id).show();
try {
jQuery.ajax({
url : url,
dataType : 'json',
success : function(data) {
jQuery('#ajax_loader'+id).hide(); //if success, hide #ajax_loader
jQuery('.popup-text').html(data.message); //if success, show .popup-text that says product is added to cart
jQuery('.fancy-popupbox').show(); //if success, show .fancy-popupbox content
//jQuery.fancybox.open('.fancy-popupbox');
setAjaxData(data,false);
}
});
} catch (e) {
}
}
</script>
请让我知道,如果我可以在此提供一些进一步的信息。
你不能使用开发工具吗? – tjons
不调试javascript/jquery没有:( – zigojacko
嗯,我为你做了。看到我的答案!:) – tjons