divisive_cotton — 2011-06-14T03:52:36-04:00 — #1
I'm using a number of JSON files with AJAX so I set the permissions to 640 to stop the world from being able to view them but by doing so AJAX then doesn't work...
What gives? Is there a work around for this?
raffles — 2011-06-14T14:23:47-04:00 — #2
Ajax just makes requests like a normal browser request that you'd type into the address bar. So to bypass this problem you need to access them via a server-side script. Since the script runs on the server, it will be able to access them.
divisive_cotton — 2011-06-15T23:57:33-04:00 — #3
If I was to do this with a server-side script through jQuery AJAX then the only response would be if the script has finished running or not. It's not possible to pass back conditionals declaring whether a duplicate has been found in the database... or maybe it is?
raffles — 2011-06-16T17:49:11-04:00 — #4
Yes it is - that's the point of AJAX. It's a request, so the server can send back a response. Often the response is sent as JSON, which I assume is what you want to do. This JSON can be static (e.g. in a txt file) or generated on the fly by a server-side script.