1. //异步加载js文件并调用函数
  2. function delayCall(calledFunction, funcParams, jsUrl)
  3. {
  4.     if (eval('typeof '+calledFunction) == 'function') {
  5.         eval(calledFunction+'(funcParams)');
  6.     } else {
  7.         jQuery.ajax({
  8.             type: 'GET',
  9.             url: jsUrl,
  10.             data: {},
  11.             dataType: 'script',
  12.             cache: true,
  13.             async: true,
  14.             success: function () {
  15.                 eval(calledFunction+'(funcParams)');
  16.             }
  17.         });
  18.     }
  19. }

  20. //同步加载js文件
  21. function syncLoad(checkFunction, jsUrl)
  22. {
  23.     if (eval('typeof '+checkFunction) != 'function') {
  24.         jQuery.ajax({
  25.             type: 'GET',
  26.             url: jsUrl,
  27.             data: {},
  28.             dataType: 'script',
  29.             cache: true,
  30.             async: false,
  31.         });
  32.     }
  33. }


08-29 19:43