Reputation: 4583
Here is the erb
<%= image_tag('number-of-people/slide1.png', class: 'def-img-width nop-style1', alt: 'style1') %>
Here is the JS
if(chooseframe == 1){
$('.nop-style1').attr('src', "<%= image_path('number-of-people/style1-a3.png') %>");
}else if(chooseframe ==2){
$('.nop-style1').attr('src', "<%= image_path('number-of-people/style1-a4.png') %>");
}else if(chooseframe ==3){
$('.nop-style1').attr('src', "<%= image_path('number-of-people/style1-a5.png') %>" );
}
Here is the error message
Bad Request
bad URI `/order_details/%3C%=%20image_path('number-of-people/style1-a3.png')%20%%3E'. WEBrick/1.3.1 (Ruby/2.2.3/2015-08-18) at gates:3000
Here is the DOM element
<img class="def-img-width nop-style1" alt="style1" src="<%= image_path('number-of-people/style1-a5.png') %>" style="display: inline; -webkit-user-select: text;">
That means image_path is not getting executing!
Upvotes: 0
Views: 70
Reputation: 4583
There is no problem with the code, but the thing is I had the above JS code in .js file. Which happens to use the erb syntax, for image_path . So I changed the file from .js to .js.erb
Upvotes: 1