Displaying 20 results from an estimated 20000 matches similar to: "pass json data into javascript"
2006 Jul 07
0
How to pass javascript variables to a method
Hello,
I''m trying to pass a record''s ID, latitude, and longitude from
javascript variables to a method in my controller. I keep getting an
Application Error and I don''t know why. Here''s what I have in my
javascript code:
<% @rID = capture do %>id<% end %>
<% @rLAT = capture do %>place.Point.coordinates[1]<% end %>
<% @rLONG =
2014 Oct 16
2
RCharts+Leaflet+Shiny
Daniel, muchas gracias por contestar y tan rápido.
Pues puede ser la solución, he hecho el cambio y sigue sin pintarme los
puntos ->
data_ <- toJSONArray(data_, json = F)
map$geoJson(
# leafletR::toGeoJSON(data_,
# # lat.lon = c('Lat', 'Long'),
# dest=output_geofile),
data_,
onEachFeature =
2008 May 20
1
AddOverlay for GeoRss Feeds, GeoRSS support
On Mon, May 19, 2008 at 4:36 PM, Pierre Romieux <promieux at gmail.com> wrote:
> Hi,
>
> Sorry for this email, but I need your help. I''m testing Mapstraction and I
> have problems with GeoRss. I''m not able to link the GeoRss markers.
> I have copied the sample with full code but nothing. The markers layer are
> not added to my page. All js are ok.
2007 Dec 27
5
Rails 2.02 dropped JSON attribute tag ?
Hey there
I was scratching my head over why my application breaks when I run on
a local server but works on my remote server. It turns out that my
local server is Rails 2.0.2 and my remote server is 1.2.3 and I expect
the tag "attributes" to be passed with a json stream, before parsing.
Unfortunately, this was dropped in 2.0.2. Is there any documentation
on this? Any way to get it back?
2014 Oct 15
2
RCharts+Leaflet+Shiny
Hola,
Ando un poco desesperado con los mapas interactivos de Rcharts
<https://github.com/ramnathv/rCharts>+Leaflet.
Estoy intentando pintar en un mapa las cámaras de tráfico de madrid, y las
estaciones de calidad del aire, simplemente donde están, es decir, aun no
estoy recogiendo los datos de medida.
Proyecto -> https://github.com/ADIRSE/maddata
He conseguido pintar ambos, con
2007 Mar 04
0
Event listeners
Hello.. I am playing around on a pilot project with this wonderful
Rails plugin.... thanks for sharing it w us !
I read in a post , in reply to this subject yjat :
Events are possible. Either through the @map.record_init "azeazeae" (for
arbitrary events like domlistener) or through the
@map.event_init(@map,:click,"function(){alert(''HOYOYO'');}").
The
2007 Aug 07
2
"badly formed JSON" exception
I tried to implement the "Rendering JSON in actions" example from
http://wiki.rubyonrails.com/rails/pages/HowtoGenerateJSON :
@headers["Content-Type"] = "text/plain; charset=utf-8"
data = { :foo => ''bar'', :etc => ''rez'' }
render :text => data.to_json
When I try to decode this in javascript with
2007 Mar 24
0
overloading to_json with JSON gem installed causing error
I installed the JSON gem because I wanted the JSON parser.
Before installing the JSON gem, overloading worked fine. Before I
remove it, I''d like to see if anyone has an idea of what is going on.
It''s the only JSON parser I''m aware of, so it would be a bummer if it
didn''t work.
After installing, if I overload the to_json method in the class, it
gives me the
2006 May 27
5
ActiveSupport JSON working?
Hi,
I am trying to convert a hash to JSON using ActiveSupports built in
.to_json. I am doing similar to the example below but are there
certain strings that could go in place of ''bar'' or ''rez'' that will
break the to_json method? I am using a very long string from rjs
output in place of ''bar''.
Perhaps .to_json is not ready yet?
Thanks,
Peter
2010 Apr 05
2
Harmonizing JSON/XML serialization
The way Rails handles root nodes in JSON and XML serialization is
inconsistent. This has been discussed before:
https://rails.lighthouseapp.com/projects/8994/tickets/2584-232-activeresource-json-doesnt-send-parameters-with-root-node
This seems mostly taken care of with
ActiveModel::Base.include_root_in_json, especially if/when it ends up
in ActiveResource. However, there is also the issue of how
2008 Jul 12
0
to_json in Rails 2.0.2 not generating proper json?
I am using Rails 2.0.2 and trying to use to_json to generate json. I
notice several problems.
1) datetime field such as created_at mapped to "created_at": {}
2) :except does not work, @post.to_json(:except =>
[:created_at, :updated_at] still gives me "created_at": {},
"update_at": {}
3) problem with escaped char mapping: ''<'' mapped to
2011 Aug 25
7
How to safely embed JSON object in HTML document
Hi all,
I''m working on a Backbone.js single page app with Rails 3.1, and in an
attempt to save on HTTP requests, I want to embed initial data set in
a HTML document that is sent back to the browser after successful
login.
I was thinking I can simply convert my ruby object to JSON, then HTML
escape resulting string of JSON, and then use that as a value for
JavaScript variable. Something
2007 Oct 04
4
2 more JSON / XML feature parity patches before Rails 2.0
I''d really like to see just 2 more functional changes to the JSON
serialization/encoding before we get to Rails 2.0.
First, and I think this is really crucial because without it all the
efforts to output JSON from ActiveRecord objects would have been half
in vain, is to allow us to do this in controllers:
@authors = Author.find(:all)
render :json => @authors.to_json(:only =>
2013 Jan 21
2
Regex for ^ (the caret symbol)?
Hello R-helpers,
I am trying to search for string that includes the caret symbol, using the
following code:
grepl("latitude^2",temp)
And R doesn't like that. It gives me:
> temp<-c("latitude^2","latitude and latitude^2","longitude^2","longitude
and longitude^2")
> temp
[1] "latitude^2" "latitude and
2012 Jun 05
2
Converiting longitude/latitude to utm
Dear all,
I have been trying to convert coordinates from longitude/latitude to utm
but I got an error. As soon as the longitude coordinate is greater than 90,
I get the folloowing error message: "error in pj_transform: latitude or
longitude exceeded limits"
Here is what I did:
SP<-SpatialPoints(cbind(126.59,-14.30),proj4string=CRS("+proj=longlat"))
2018 Jan 19
1
Leaflet maps. Nudging co-incident markers
I have a dataset showing points, with a category for each point and its location.
I simply want to display my points, in a way that users can toggle the points on and off by category.
Where I have two objects in the same category I'd like to display them nudged to appear as two distinct, but very close points.
I have made reproduceable example (the places are not real), which is loosely
2010 Nov 01
0
function: colvolve
Hi list,
I have a problem to solve which I believe I shoudl use the convolve to solve
it, but I could not figure out how to do it.
I got mydata, which is a dataframe which has 7 locations, each location has
a longitude,latitude and a value.
considering a step of 0.5 degree for longitudes and latitudes, I got 15
points for longitude and 15 points for latitude. Then
I created a grid, mygrid, which
2009 Mar 24
0
Patch: clickHandlers in VirtualEarth
Hi,
my mapstraction onclick event handlers always yielded javascript
errors in Virtual Earth maps ("e.view is undefined").
I''m using version 6 of mapcontrol.ashx. After consulting Virtual Earth
documentation, I came up with a solution.
Here is my patch (based on rev 212)
> var that = this;
360c361,368
< me.clickHandler(e.view.LatLong.Latitude,
2005 Jul 09
0
ActiveRecord JSON Objects
Someone asked me in IRC if javascript can access ActiveRecord
properties. At first, this seemed like a silly request. But then I
remember JSON and thought, why can''t you?
I implemented a quick ActiveRecord -> JSON converter using the ruby-json gem.
http://rafb.net/paste/results/Yixi5I21.html
One problem was that I have to call .to_s to convert everything to a
format for JSON.
2009 Dec 08
0
ActiveSupport 2.3.5 and json 1.2.0 gem
Hey,
I''ve tried every trick I can find, yet I''m still unable to get the
json gem and ActiveSupport to play nice.
No matter in which order I load json and active support, I still end
up with: NoMethodError: undefined method `[]'' for
#<JSON::Ext::Generator::State:0x104b7fac0>
I''m trying to use the JSON object directly, *not* as a ActiveSupport backend: