I have an ajax task to return a form token from my controller for use in ajax pages, so that subsequent ajax requests will have a token. It looks like this in the code:
JURI::root().'index.php?option=com_mycomponent&format=raw&task=ajax.tokenRequest'
and like this in the ajax request:
http://localhost/joomla3/index.php?option=com_mycomponent&format=raw&task=ajax.tokenRequest
This works fine, until I use it in a multilingual site. In this case, the server returns a 303 error with the suggested redirect to
http://localhost/joomla3/en/?option=com_mycomponent&format=raw&task=ajax.tokenRequest
and the token never gets populated.
Is there something I need to do similar to JRoute::_()
on the URL to ensure that the right URL is used and a 303 is not returned? (I did try JRoute but this didn't have any effect).
Thanks