Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I currently have this code and I want to know how to store it, and then use it, in a database:

var stores = {
"McDonalds" : .90,
"Target" : .92,
"iTunes" : .95,
"Starbucks" : .87,
"Best Buy" : .93,
}

This list will be different and much bigger, but thats an example. It is currently put into action using:

<script src="location"></script>

I want to hide it in a database so that it isn't accessible to customers or competitors. How can I do that? And, when doing so, how would I then have my page access it instead of using script src?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You can't hide this from your customers, and still have your customers use that data in their browser. That isn't how the Internet works. If the browser needs to read that data, the user can also read that data.

If you can move whatever calculation you're doing server-side, that might be an option, but these are pretty simple values, and I'm guessing that people will have little difficulty guessing them simply by examining the inputs and outputs of your algorithm.

share|improve this answer
    
Ah, ok, I was hoping I could maybe write code to access it, take the necessary value, and only return that value. I would prefer that to a customer seeing my entire list via the js location. –  BlueRiver89 Jun 28 at 6:14
    
You can do exactly that. The question "how do I do that" is far too broad for Stack Overflow. The answer is build a program that does that; you're going to have to ask something more specific. –  meagar Jun 28 at 6:14
    
Okay, thank you. –  BlueRiver89 Jun 28 at 6:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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