Link to home
Start Free TrialLog in
Avatar of mmathis32
mmathis32

asked on

Syntax Javascript error

I have the following script in my file:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"url": "http://www.hotislandspots.com",
"logo": "http://www.hotislandspots.com/assets/images/res/ak_logo.png"
"contactPoint" : [
{ "@type" : "ContactPoint", "telephone" : "+1-888-xxx-xxxx" } ] }
"sameAs" : [ "https://www.facebook.com/hotislandspots",
"https://www.youtube.com/user/hotislandspots",
"https://www.pinterest.com/hotislandspots",
"https://twitter.com/hotislandspots",
"https://instagram.com/hotislandspots"]
}
</script>

Open in new window

I am getting a syntax error on the line that reads "@context": "http://schema.org",
I don't see what's wrong.  Can anyone give me some help?
Avatar of Rob
Rob
Flag of Australia image

There was a missing comma and a floating end curly bracket.

Here is the updated code:

{
"@context": "http://schema.org",
"@type": "Organization",
"url": "http://www.hotislandspots.com",
"logo": "http://www.hotislandspots.com/assets/images/res/ak_logo.png",
"contactPoint" : [
{ "@type" : "ContactPoint", "telephone" : "+1-888-xxx-xxxx" } ],
"sameAs" : [ "https://www.facebook.com/hotislandspots",
"https://www.youtube.com/user/hotislandspots",
"https://www.pinterest.com/hotislandspots",
"https://twitter.com/hotislandspots",
"https://instagram.com/hotislandspots"]
}

Open in new window

Avatar of mmathis32
mmathis32

ASKER

it still says the same thing.
change <script type="application/ld+json"> to just <script>

I'm not seeing the error.
Here is what i mean... you can see that it outputs the object successfully to the console:  http://jsbin.com/tugiha/1/edit?js,console
Still says the same thing. I added a [ at the beginning of line ["@context": "http://schema.org", and it still says the same thing.
Did you see the jsbin i posted?

All you're doing by adding a [ is making an array.

What's the context of this?  I need to see more of your code to know what's going on, because as you can see by the jsbin link, there's nothing wrong with the revised code I posted above.
Maybe it's a dreamweaver thing. IT says code hinting may not work until you fix this error.
Yes I saw your jsbin. Thanks so much!
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK THANKS! YOU HELP HAS BEEN INVALUABLE!
No problem! thanks for the points :)
ur welcome