I have a javascript file that has the variable named locations, with some data in quotes for example, 'name', '123 lane', and etc. I want the variable to get data from a database and not the plain text. How do I insert the code to do this into my JavaScript variable? I'm new to this, Thanks!!

  • You might want to start here: w3schools.com/js/default.asp – closetnoc Apr 8 '15 at 2:40
  • 1
    Unfortunately questions about coding are considered off-topic here. You might ask this over at Stack Overflow, but be sure to include enough details and any code you've tried, as they generally like to see some attempt at coding first. – dan Apr 8 '15 at 4:00

It seams like the best way to go about it, is to have a php file which returns the output of your data set; and just make a ajax call to it. Maybe these resources will help:

Not the answer you're looking for? Browse other questions tagged or ask your own question.