I'm working with a plugin that appears to have a json string that defines various objects. var controls = [{'ID':'tgctlcm','RA':'False','Downloadable':'1','Name':'SupportSoft CM Check Control','XPI':'','JAR':'SupportSoft/Configuration','MIME':'application/x-SupportSoft-Configuration-Plugin','ClassID':'01113300-3E00-11D2-8470-0060089874ED','Version':'7.0.1372.0','RegKey':'','ProgID':'sdcuser.tgconfctl'},{'ID':'tgctlins','RA':'False','Downloadable':'1','Name':'SupportSoft Install Control','XPI':'SupportSoft Installer','JAR':'SupportSoft/Installer','MIME':'application/x-SupportSoft-Install-Plugin','ClassID':'01010200-5e80-11d8-9e86-0007e96c65ae','Version':'6.9.2205.0','RegKey':'nptgctlinsKey','ProgID':''} Code (markup): These objects are then looped through and made available in the document: function _getUserControl(ctlname) { var objCM = null; $.each(controls, function(i, v) { if (v.ID == ctlname) { objCM = v; } }); return objCM; } Code (markup): I'm able to access these objects using the ID in the JSON string so I could access it like this: document.tgctlcm Code (markup): This works when I run it from my desktop but when I put it in a stand alone server or on a domain I get an: "Access is Denied" error anytime I try to access the object. Any idea why this would be working from the desktop but not on a server? I've been banging my head for hours on this.
I'm not certain I'm following your code logic -- you seem to keep looping even once you know the result, wasting an extra variable in the process; of course with the pointless idiotic jQuery garbage on the table you seem to be wasting code on something simple. You could make it much, MUCH faster by simply making the ID an index for the objects... something like this: var controls = { tgctlcm : { RA : 'False', Downloadable : '1', Name : 'SupportSoft CM Check Control', XPI : '', JAR : 'SupportSoft/Configuration', MIME : 'application/x-SupportSoft-Configuration-Plugin', ClassID : '01113300-3E00-11D2-8470-0060089874ED', Version : '7.0.1372.0', RegKey : '', ProgID : 'sdcuser.tgconfctl' }, tgctlins : { RA : 'False', Downloadable : '1', Name : 'SupportSoft Install Control', XPI : 'SupportSoft Installer', JAR : 'SupportSoft/Installer', MIME : 'application/x-SupportSoft-Install-Plugin', ClassID : '01010200-5e80-11d8-9e86-0007e96c65ae', Version : '6.9.2205.0', RegKey : 'nptgctlinsKey', ProgID : '' } }; Code (markup): would then let you get rid of all that 'each' jquery nonsense and simply access it as: controls.tgctlins or controls['tgctlins'] Instead of that time-wasting function -- a hell of a lot simpler. (also not sure why you had all those extra single quotes around your indexes) Not sure why it wouldn't work server-side unless you're pulling your scripts from different domains or something. The error you have there is typical of a cross-site scripting block. I'd have to see the page in question to weigh in more on why it wouldn't be working.