Topic: Javascript to controller

Not quite sure if this is the right section, but here we go.

Im creating a little app where i can put markers on a Google maps map. The moment i place a marker i want a textfield to appear where people can fill in a title and all that. Also a hidden field with the given coordinates. Now, i've got the javascript working fine. However, not with Rails. I've followed a tutorial which creates an extra field to your form(http://railscasts.com/episodes/197-nested-model-form-part-2) but i've gotta turn around his method.

So what i need is the javascript to tell my controller "Give me another formfield!". This will pickup the functions used in the railscast i linked above. Can anyone help me with this?

Re: Javascript to controller

have you tried to use $.ajax from jQuery ?
if you're familiar with jQuery, you can make the javascript to tell your controller such this:

$.ajax({
 url:'url_to_method_in_controller',
 data:'data_to_be_sent',
 success:function(data){
  //do something here, for example, appending new form field
  }
})