Skip to main content
added a code snipt
Source Link
Zachary K
  • 10.4k
  • 2
  • 39
  • 55

I can think of several places where I would do this

  1. Simple testing of an idea, I want to see how something works and don't intend to keep the code.

  2. Data initialization, where the actual program logic is in an external file but I want to load initial data for some reason and don't want to have an ajax call to get it. For example if I have a list of countries that I will need to use that would be a perfect candidate. It will change rarely and can be inserted into the HTML page by way of whatever language I am using server side (PHP, Ruby, Haskell etc), in this case I may have some code like this

    Data.countries = ;

I can think of several places where I would do this

  1. Simple testing of an idea, I want to see how something works and don't intend to keep the code.

  2. Data initialization, where the actual program logic is in an external file but I want to load initial data for some reason and don't want to have an ajax call to get it. For example if I have a list of countries that I will need to use that would be a perfect candidate. It will change rarely and can be inserted into the HTML page by way of whatever language I am using server side (PHP, Ruby, Haskell etc)

I can think of several places where I would do this

  1. Simple testing of an idea, I want to see how something works and don't intend to keep the code.

  2. Data initialization, where the actual program logic is in an external file but I want to load initial data for some reason and don't want to have an ajax call to get it. For example if I have a list of countries that I will need to use that would be a perfect candidate. It will change rarely and can be inserted into the HTML page by way of whatever language I am using server side (PHP, Ruby, Haskell etc), in this case I may have some code like this

    Data.countries = ;

Source Link
Zachary K
  • 10.4k
  • 2
  • 39
  • 55

I can think of several places where I would do this

  1. Simple testing of an idea, I want to see how something works and don't intend to keep the code.

  2. Data initialization, where the actual program logic is in an external file but I want to load initial data for some reason and don't want to have an ajax call to get it. For example if I have a list of countries that I will need to use that would be a perfect candidate. It will change rarely and can be inserted into the HTML page by way of whatever language I am using server side (PHP, Ruby, Haskell etc)