We have a javascript code in which url of selected image is obtained in javascript variable (src). We want to access src var in rails view to obtain the id of the selected image.Tried this by using Ajax where we tried passing the url to var created in controller but somehow the ajax call isn't working,therefore controller var always show nil value. we have tried ajax by 2 method:
1:
$('#submit').click(function(){
$.ajax({
type: "POST",
url: "index",
cache: false,
data: "src="+src1,
success: function(){
alert("DATA SAVED");
}
});
2:
<%= link_to_remote "submit" , :url=>{:controller=>'album',:action =>'index' ,:var=>'src1'}%>