I would like to use Objects better, because I would like to use the
little search code. When I try and run the program the error message I
get from FF is 'Error: abbrs[somevar] is undefined'.
The full script:

$("#load_abbr_data").click(function()
{
var abbrs = {}

        $.getJSON("jsondata.php",function(data)
                {


                        $.each(data.abbr_data, function(i,get_abbr_data)
                        {
                                var abbr = get_abbr_data.ABBR;
                                var desc = get_abbr_data.DESCRIPTION;
                                var lang =  get_abbr_data.LANG;

                                abbrs =
                                {
                                        abbr : [desc],
                                }


                        });


                });

        var somevar = "PHP";
        for( var i = 0 ; i < abbrs[somevar].length; i++)
        {
                var expanded = abbrs[somevar];

        }
        document.write( somevar + " is short for " + expanded );

});

Reply via email to