I have some specific situation, I have to initiate remote ajax call from javascript (using serial port to read rfid data) and I want to send it and get ajax response. This is what I want to call:
<%= link_to "evidentiraj", {:action => 'time', :id=>25}, :remote => true %>
I tried manually to start xmlhttp.opetn from javascript, but it does not work:
xmlhttp.open("GET","/evidentiraj/time?id=23",true);
xmlhttp.send();
Thank you. Dorijan
You can run rake routes
and look for the url you need, I think it should be something like time_evidentiraj
. Then, in your view:
xmlhttp.open("GET","<%= time_evidentiraj_path(@evidentiraj) %>",true);
xmlhttp.send();
time_evidentiraj_path(:id=>23, :format => 'js')
- alf 2012-04-04 18:10