I know that I’m missing something very simple but I setup my
application to use for the links a remote=> true call. In the call it
finds the js.erb file, but doesn’t render into the browser the
content.
LOG:
Started GET “/” for 127.0.0.1 at 2010-06-28 14:26:22 -0700
Processing by HomeController#index as JS
Rendered home/index.js.erb (0.3ms)
Completed 200 OK in 12ms (Views: 11.6ms | ActiveRecord: 0.0ms)
Started GET “/” for 127.0.0.1 at 2010-06-28 14:26:25 -0700
Processing by HomeController#index as HTML
Rendered home/index.html.erb within layouts/application (2.0ms)
Completed 200 OK in 6ms (Views: 5.6ms | ActiveRecord: 0.0ms)
As you can see in the html.erb it says within the layouts/application
But with the JS call it is missing -
my template looks like this -
<li><a href="/" >Home</a></li> // This one works
What am I doing wrong?
The jQuery data-remote tag looks like this -
$(‘a[data-remote],input[data-remote]’).live(‘click’, function (e)
{
$(this).callRemote();
e.preventDefault();
});
$(‘a[data-method]:not([data-remote])’).live(‘click’, function (e){
var link = $(this),
href = link.attr(‘href’),
method = link.attr(‘data-method’),
form = $(’’),
metadata_input = ‘’;
if (csrf_param != null && csrf_token != null) {
metadata_input += '<input name="'+csrf_param+'"
value="’+csrf_token+’" type=“hidden” />’;
}
form.hide()
.append(metadata_input)
.appendTo('body');
e.preventDefault();
form.submit();
});
Is it missing something?