0

This is the error I am getting and it's frustrating me


syntax error, unexpected tIDENTIFIER, expecting $end (SyntaxError) $.get^ ("https://spreadsheets.googl...


looking at the same code here ... jsfiddle

$.get "//spreadsheets.google.com/feeds/cells/1BN0MH3ZPpCq6Bh60a7Z09Np-fZUZzZOb3tXyCZRPvHs/od6/public/values?alt=json", (data) ->
r = 0
item_ = "["
i = 0
while i < data.feed.entry.length
   row = data.feed.entry[i].gs$cell.row
   cont = data.feed.entry[i].gs$cell.$t
   unless row is r
       item_ += " {:label=>" + cont
   else
       item_ += ", :value=>" + cont + "},"
   r = row
   i++
   item_ += "]"
   item_=item_.replace("},,", ",")
   item_=item_.replace("},]", "}]")
alert item_
return

its working

Hortitude
  • 13,638
  • 16
  • 58
  • 72
  • only some commented text... do I need to remove it – bcharagu May 03 '14 at 07:47
  • I tried removing the comments and still bringing the same result. The comments were done with a # – bcharagu May 04 '14 at 00:22
  • Do you have jquery loaded correctly in the page where you're running this? – Joe Hildebrand May 04 '14 at 20:26
  • require 'json' require 'backports' $.get "https://spreadsheets.google.com/feeds/cells/1BN0MH3ZPpCq6Bh60a7Z09Np-fZUZzZOb3tXyCZRPvHs/od6/public/values?alt=json", (data) -> r = 0 item_ = "[" i = 0 while i < data.feed.entry.length row = data.feed.entry[i].gs$cell.row cont = data.feed.entry[i].gs$cell.$t unless row is r item_ += " {:label=>" + cont else item_ += ", :value=>" + cont + "}," r = row i++ item_ += "]" – bcharagu May 04 '14 at 21:21
  • Your question Joe got me thinking on jquery. I have gem installed jquery and did a require jquery on the script. The error is still there. When I did bundle show its not being included. I cannot install jquery-rails since the versions required are conflicting. bashing requires ruby 1.9.2 while jquery requires 1.9.3. I dont know if this is the reason its not working – bcharagu May 05 '14 at 06:31
  • Part of the Gems installed are as below but still getting the errors. Gems included by the bundle: * actionpack (4.1.0) * actionview (4.1.0) * activesupport (4.1.0) * addressable (2.3.6) * backports (3.6.0) * buftok (0.2.0) * builder (3.2.2) * bundler (1.6.2) * coffee-script (2.2.0) * coffee-script-source (1.7.0) * daemons (1.1.9) * dashing (1.3.2) * equalizer (0.0.9) * erubis (2.7.0) * jquery-rails (3.1.0) * json (1.8.1) * memoizable (0.4.2) Please help – bcharagu May 05 '14 at 20:40

1 Answers1

0

First of all, you don't need to add jquery because it is already included for you. Also, this uses Sinatra and not Rails, so jquery-rails won't do you much good. Also, don't fetch the data client side, fetch it server side. That way, the data will be in sync with all open clients. Check this example out: https://github.com/Shopify/dashing/issues/78#issuecomment-14940695. It uses something called 'roo' which apparently supports google spreadsheets.

pushmatrix
  • 726
  • 1
  • 9
  • 23
  • my jobs/buzzwords.rb as below require 'roo' $.get "https://spreadsheets.google.com/feeds/cells/1BN0MH3ZPpCq6Bh60a7Z09Np-fZUZzZOb3tXyCZRPvHs/od6/public/values?alt=json", (data) -> r = 0 item_ = "[" i = 0 while i < data.feed.entry.length row = data.feed.entry[i].gs$cell.row cont = data.feed.entry[i].gs$cell.$t unless row is r item_ += " {:label=>" + cont else item_ += ", :value=>" + cont + "}," r = row i++ item_ += "]" item_ = item_.replace("},,", ",") return SCHEDULER.every '1m', :first_in => 0 do |job| send_event('buzzwords', {items: item_ }) end – bcharagu May 11 '14 at 20:28