我正在通过文件中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
设置关闭时我的网址参数
index.php?option=com_requests&controller=dashboard&task=messagesendtocook
成功运行。
SEO
设置为"开"时的"我的网址"参数
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();
});
我发现只需在URL中添加前导/
的工作方式相同,将其转换为:
'/index.php?option=com_requests&controller=dashboard&task=messagesendtocook&format=raw&tmpl=component'