SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast firehawk777's Avatar
    Join Date
    Feb 2011
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    retrieving JSON array from text file

    Hi there all
    I am fairly new to javascript and I am wondering how I would load a text file that has a JSON formatted array stored in it?
    I can pass the array directly to the page via php though I want to be able to store the data and save on calls to the database and of course load the data dynamically to the page.

  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)
    XMLHttpRequest can do this via JavaScript without having to reload the page. But it's going to have to talk to a PHP file which will have to get the JSON from the database anyway, so it's not going to save you on database calls.

    The main advantage of XMLHttpRequests is that the user does not have to reload the page, i.e. they stay where they are but can get fresh bits of content from the server.


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
  •