SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: JSON

  1. #1
    SitePoint Guru
    Join Date
    Jun 2009
    Posts
    820
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    JSON

    I'm doing this test

    http://cfusion.hgtv.com/feeq/fee.html

    if I put this in my JavaScript,

    Code:
    {"items": [
    {
    "title": "sample 1",
    "author": "author 1"
    },
    {
    "title": "sample 2",
    "author": "author 2"
    }
    ]}
    it throws an error



    only works if I do

    Code:
     var jsonTest = {"items": [
    	{
    	"title": "sample 1",
    	"author": "author 1"
    	},
    	{
    	"title": "sample 2",
    	"author": "author 2"
    	}
    ]}

    would this be ok??
    (code sample in test throws error..)

    also, this is the syntax in JSON site:
    http://www.json.org/js.html
    (with var decl in front)

    thank you..

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    The page you linked to only displays the JSON...not the javascript surrounding it in order to make it work. Technically, it's not an error--just an omission that's up to you to figure out.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Guru
    Join Date
    Jun 2009
    Posts
    820
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    grand.... ;-)

    ok, thank you...


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
  •