Jseb Jseb - 1 year ago 50
Javascript Question

Ruby on Rails with jquery load and sending data

I am wondering how I can send data. I have the following code

$( "#dialog" ).load('/events/relates ' + '#eventconfirm', { data: 'Hello World' }).dialog('open');

But it doesn't work. What I want is to load
and only get the selection
, which works, but I would like to add data so the controller can read the
and act upon it.

Answer Source

no need to append the url and try calling the plugin in the .load callback like

$("#dialog").dialog();//first initailize the plugin
//then load the content 
$( "#dialog" ).load('/events/relates#eventconfirm', { data: 'Hello World' },function(data){