Problem: To create the following structure dynamically in javascript. var employees = {“accounting”: [ // accounting is an array in employees. { "firstName" : "John", // First element "lastName" : "Doe", "age" : 23 }, { "firstName" : "Mary", // Second Element "lastName" : "Smith", "age" : 32 } ] // End “accounting” array. } [...]
Posts Tagged ‘javascripts’
Creating Javascript array with JSON format dynamically
Posted in Javascript, tagged javascripts on September 26, 2011 | Leave a Comment »
Calling External Javascript after Ajax Call [Mootoools]
Posted in Javascript, tagged javascripts, lessons, tips on April 24, 2009 | 1 Comment »
If you are trying to run the script in an updated div, that may work with the internal scripts – something like; <script type=”text/javascript”> alert(‘hello’); </script> But when you try to access some external javascrips, (e.g); <script type=”text/javascript”> <script type=”text/javascript” src=”/javascripts/my_script.js”></script> </script> that will not work. The work-around is; [if you are using mootools.js for [...]
Inspect Javascript Object
Posted in Javascript, tagged javascripts, lessons, programming, tips on October 21, 2008 | Leave a Comment »
function inspect_object( obj ) { var str = ”; for( var memb in obj ) str += memb + ‘ = ‘ + obj[memb] + ‘n’; alert(str); return str; }