【问题标题】:Ajax URL not working when SEF settings is ON in Global configuration of Joomla在 Joomla 的全局配置中打开 SEF 设置时,Ajax URL 不起作用
【发布时间】:2013-11-26 03:25:51
【问题描述】:

我通过文件中的JQuery.post 方法传递我的数据。当 Joomla 2.5 中的服务器上的“搜索引擎友好 URL”和“使用 URL 重写”关闭时,它可以成功运行,但是当这两个设置都打开时,JQuery.post 的 URL 正在更改并且无法正常工作。

jQuery.post('index.php?option=com_requests&controller=dashboard&task=messagesendtocook&format=raw&tmpl=component', { 
    replymessage:replymessage,fromid:fromido,msdid:msdido,refid:refido}, function(data) {
        alert(data);
        setTimeout( 'reload_parent_window();', 2000 );  
        window.parent.SqueezeBox.close();
}); 

SEO 设置为 OFF 时我的 URL 参数

index.php?option=com_requests&controller=dashboard&task=messagesendtocook

成功运行。

SEO 设置为 ON 时的我的 URL 参数

index.php/component/requests/index.php?option=com_requests&controller=dashboard&task=messagesendtocook

哪个没有运行。

【问题讨论】:

    标签: php jquery joomla joomla2.5 joomla-sef-urls


    【解决方案1】:

    Juri::root() 与网址一起使用。 所以代码是-

    jQuery.post('<?php echo Juri::root()?>index.php?option=com_requests&controller=dashboard&task=messagesendtocook&format=raw&tmpl=component', { 
        replymessage:replymessage,fromid:fromido,msdid:msdido,refid:refido}, function(data) {
            alert(data);
            setTimeout( 'reload_parent_window();', 2000 );  
            window.parent.SqueezeBox.close();
    }); 
    

    【讨论】:

    • @user2841211 : url 和以前一样吗?
    【解决方案2】:

    我发现在 URL 中添加一个前导 / 也是一样的,把它变成:

    '/index.php?option=com_requests&controller=dashboard&task=messagesendtocook&format=raw&tmpl=component'
    

    【讨论】:

      猜你喜欢
      • 2010-12-22
      • 1970-01-01
      • 1970-01-01
      • 2017-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-04
      • 1970-01-01
      相关资源
      最近更新 更多