Here is non ajax method(but ajax pretty the same):
var f = document.createElement(''form'');
f.style.display = ''none'';
this.parentNode.appendChild(f);
f.method = ''POST''; #or get
f.action = this.href;
var m = document.createElement(''input'');
m.setAttribute(''type'', ''hidden'');
m.setAttribute(''name'', ''_method'');
//m.setAttribute(''value'', ''delete''); #or
put it depends of your needs
f.appendChild(m);
//Now we can send your variables:
var s = document.createElement(''input'');
s.setAttribute(''type'', ''hidden'');
s.setAttribute(''name'', ''my_var'');
s.setAttribute(''value'', ''my_var_value'');
f.appendChild(s);
f.submit();
On Mar 18, 10:48 pm, Mohammed Alenazi
<vb4...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I am trying to build an application that has google maps. Inside the
> script there are two java script variables. I want to send those two
> variables using a java function. What is the best why to do that.
> Could someone give me a simple example on that.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.