SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JSON file permissions

    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?
    Let everyday be Christmas

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wanted to check email addresses and usernames to make sure that there are no duplicates during JavaScript validation...

    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?
    Let everyday be Christmas

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •