我通过文件中的 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
设置关闭时我的 URL 参数
index.php?option=com_requests&controller=dashboard&task=messagesendtocook
运行成功。
SEO
设置开启时我的 URL 参数
index.php/component/requests/index.php?option=com_requests&controller=dashboard&task=messagesendtocook
它没有运行。
最佳答案
使用 Juri::root()
和 url。
所以代码是-
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();
});
关于php - 当 Joomla 全局配置中的 SEF 设置为 ON 时,Ajax URL 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19955283/