Internet explorer global javascript files -


i building php mvc website , include several js files.. problem encounter if have example js file containing functions , needed variables can't use them in other js files (i call functions using document.ready() , use jquery make ajax calls). works fine in firefox ie throws error... include js files using html class:

function includejs($filename) {     $data = '<script src="'.base_path.'/public/js/'.$filename.'.js" type="text/javascript"></script>';     return $data; } 

this error i'm getting:

 webpage error details user agent: mozilla/4.0 (compatible; msie 8.0; windows nt 6.1; trident/4.0;             slcc2; .net clr 2.0.50727; .net clr 3.5.30729; .net clr 3.0.30729;             media center pc 6.0; infopath.3; .net clr 1.1.4322)             timestamp: thu, 3 mar 2011 11:53:33 utc  message: expected identifier line: 26 char: 21 code: 0          uri: http://localhost/learning/public/js/general.js message: object expected line: 5 char: 3 code: 0          uri: http://localhost/learning/public/js/tests.js 

it sounds have syntax error in js file problem ie , not firefox.

typically type of error trailing comma in array or object.

for instance [1,2,3,] valid in firefox, not in ie. make valid in ie need remove trailing comma, looks [1,2,3].

the same goes objects if have { foo: 1, bar: 2,} fail in ie not in firefox.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -