Registerpackage, Script Positioning Problems, Ajax Response

Hello guys i wonder if you can help me on this. I am trying to register google api, gmap3 (jquery framework for googlemaps), sample.js (my own js file)

$package_api = array(

			'baseUrl'=> $http .'://',

			'js' => array('js?' . http_build_query($params))


	$package_map = array(

		    'basePath'    => 'ext.gmap3',

	    	'js'          => array( 'gmap3.js' )



	$package_sample = array(

	    'basePath'    => 'application.views.sample.assets.js',

    	'js'          => array( 'sample.js' )




				  ->addPackage('package-api', $package_api)

				  ->registerPackage( 'package-api' )

		          ->addPackage( 'package-map', $package_map )

		          ->registerPackage( 'package-map' )

		          ->addPackage( 'package-sample', $package_sample )

		          ->registerPackage( 'package-sample' );

Then i added the script below to show if the gmap3 function exists and it returned true.

Execute first:

Yii::app()->clientScript->registerScript('loadResult', '				


	', CClientScript::POS_END);

//returned true

Execute after:

But when i Added console.log($.isFunction($.fn.gmap3)); after ajax response it returned false, so gmap3 doesn’t exist