Search code examples
javascriptjquerygetjson

Jquery javascript stock quoter how to get company name?


I am having an issue with getJSON and pulling the company name from the JSON file. the JSON file stores the name as ,"name" : "Facebook Inc". So in my code when i set to

var company = date[0].name; 

This is where the issue is since .name is a keyword. How do i get around this.


Solution

  • You made a simple typo :

    var company = date[0].name;
    

    Try this :

    var company = data[0].name;