我在我的文件中通过JQuery.post
方法传递数据。当Joomla 2.5中的服务器上的“搜索引擎友好URL”和“使用URL重写”关闭时,它的工作成功,但当两个设置都为ON时,JQuery.post
的网址会发生变化而无法正常工作。
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
设置为关闭时的网址参数
index.php?option=com_requests&controller=dashboard&task=messagesendtocook
成功运行。
SEO
设置为开启时的网址参数
index.php/component/requests/index.php?option=com_requests&controller=dashboard&task=messagesendtocook
没有运行。
答案 0 :(得分:3)
将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();
});
答案 1 :(得分:0)
我发现只需在网址中添加一个前导/
就可以了,将其转换为:
'/index.php?option=com_requests&controller=dashboard&task=messagesendtocook&format=raw&tmpl=component'