I want to load jquery in an external js file and use it. Am doing it in test.js the below given way
   var src='http://code.jquery.com/jquery-1.10.1.min.js';
   document.write('<sc'+'ript type="text/javascript" src="'+src+'" onload="init()">     </sc'+'ript>');
 function  init(){
       $(function(){
         //jquery code here
  });
 }
Am getting $ reference error if do not call function init() onload. any other better method , then suggest me. Thanks