javascript - How to pass image path in js function -
i'm trying pass image path dynamically 1 jsp page using js function, image path in js alert
different. correct path .\products\767\76\suitmed.jpg
alert shows me .\products>7>suitmed.jpg
. can 1 please me this.
productdiv.jsp
<c:foreach items="${products}" var="products"> <div class="col-sm-4"> <div class="product-image-wrapper"> <div class="single-products"> <div class="productinfo text-center"> <!--here in image tag trying pass path od med , large img product obj --> <img src="${products.smallimage}" onclick="getimagedetails('${products.mediumimage}', '${products.largeimage}'); return false;" alt="${products.productid}+productimage" /> <h2>${products.allprice}</h2> <p>${products.name}</p> </div> </div> <div class="choose"> <ul class="nav nav-pills nav-justified"> <li> <a href=""> <i class="fa fa-plus-square"></i> add wishlist </a> </li> </ul> </div> </div> </div> </c:foreach>
product.js
function getimagedetails(mediumimagepath, largeimagepath) { alert(mediumimagepath + "_______" + largeimagepath); $("#bigimage").attr("src", mediumimagepath); }
product details.jsp
<div class="view-product" > <img class="fancybox" id="bigimage" src="" data-big="images/home/suitlarge.jpg" /></br> <!--<img src="images/product-details/1.jpg" alt="" /> --> <h3>zoom</h3> </div>
never programmed jsp, here plausible explanation:
\## interpreted octal character escape sequence.
char octal dec hex description < 74 60 3c less sign (< in html) = 75 61 3d equals sign > 76 62 3e greater sign (> in html) ? 77 63 3f question mark
so "\76" becomes ">" when printing..
try replacing "\" "/" in paths helps out, , webservices can handle translation unix styled paths windows styled..
Comments
Post a Comment