1

I am passing my data through JQuery.post method in my file. Its working successfully when "Search Engine Friendly URLs" and "Use URL rewriting" is OFF on server in Joomla 2.5 but when both settings is ON then url of JQuery.post is getting changed and not working properly.

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();
}); 

My URL parameter when SEO settings is OFF

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

which run successfully.

My URL parameter when SEO settings is ON

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

which is not running.

Smern
  • 18,746
  • 21
  • 72
  • 90
anumavu
  • 13
  • 3

2 Answers2

3

Use Juri::root() with url. So the code would be-

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();
}); 
Irfan
  • 7,029
  • 3
  • 42
  • 57
0

I found that just adding a leading / to the URL worked the same, turning it into:

'/index.php?option=com_requests&controller=dashboard&task=messagesendtocook&format=raw&tmpl=component'
honk
  • 9,137
  • 11
  • 75
  • 83