0

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?

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.