Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery.load中断的超链接和图像的URL路径_Javascript_Php_Jquery - Fatal编程技术网

Javascript jquery.load中断的超链接和图像的URL路径

Javascript jquery.load中断的超链接和图像的URL路径,javascript,php,jquery,Javascript,Php,Jquery,尝试使用论坛我们在网页上的评论部分,同时避免使用iFrame <script> $('#test').load('./forum/viewtopic.php?f=13&t=10' function(result) { var variable = $('#result').html(); $(this).find(".topic-title").remove(); $(this).find(".action-bar").remove()

尝试使用论坛我们在网页上的评论部分,同时避免使用iFrame

    <script>
    $('#test').load('./forum/viewtopic.php?f=13&t=10' function(result) {
    var variable = $('#result').html();
    $(this).find(".topic-title").remove();
    $(this).find(".action-bar").remove();
    $(this).find(".postprofile").remove();
    </script>
并尝试使用
$(“#测试脚本”)
以及
path+'/forum'
,但运气不佳。此时,它的内容被推送到id=“test”的div中

有人给我一些建议吗

$(function() {
        $('script').each(function() {
            $(this).attr('text/javascript', function(index, value) {
                if (value.substr(0,1) !== "/") {
                    value = window.location.pathname + value;
                }
                return "https://site[dot]com/forum" + value;
            });
        });
    });
});
更新:我通过设置PHPBB_ROOT_路径获得了一些运气:“../forum”;在viewtopic.php中,这修复了我的相对路径问题,并开始正确加载所有标题。但是现在,一旦通过ajax表单提交帖子,帖子就会成功提交,但是刷新ajax页面时出错。使用jquery加载到div中。你知道这是什么吗?我认为这是一个jquery/.load问题,因为表单在实际论坛页面上运行良好 为了你生命中的每一个电话 viewtopic.php文件

-编辑:

尝试在根文件夹中使用httacces文件 检查此线程:


这是因为您调用的页面内容使用相对链接。因此,它们被转换为相对于您当前的URL。如果您不希望出现这种行为,您必须循环浏览所有链接并更新它们的
href
属性“有人给我一些提示吗?”是的,在
需要查看受影响html的示例以修改路径之前关闭函数我不可能对phpbb中的每个链接都执行此操作我想是的,这就是为什么我尝试这样重写^I知道原因,我无法进行重写您也可以尝试使用httacces重定向,请看我编辑的答案。允许在viewtopic.php中指定路径的唯一位置在$phpbb_root_path=(defined('phpbb_root_path')下?PHPBB_ROOT_PATH:它不接受绝对路径。必须与目录脚本相关,我可以告诉RewriteRule(/.*)上的RewriteEngine已用尽。$/forum$1[L,NC,R=301]没有工作,有什么想法吗?
$(function() {
        $('script').each(function() {
            $(this).attr('text/javascript', function(index, value) {
                if (value.substr(0,1) !== "/") {
                    value = window.location.pathname + value;
                }
                return "https://site[dot]com/forum" + value;
            });
        });
    });
});