I wrote a component for Joomla 2.5 which uses jquery in the admin part. The js-script calles a helper php file (addrow.php), which returnes a new row for a table using Joomla's form fields. Because that file is outside of the Joomla framework I used these lines to make it work:
define( '_JEXEC', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../..' ));
require_once( JPATH_BASE.'includes/defines.php' );
require_once( JPATH_BASE.'includes/framework.php' );
require_once( JPATH_BASE.'libraries/joomla/factory.php' );
After the upgrade to Joomla 3.2, this didn't work anymore, I just got
Error displaying the error page: Application Instantiation Error
but by adding
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
it works again.
My question is, if this is in general the proper way to write external php-scripts for jquery?
And is getApplication('site') correct even if it's for admin?