daily pastebin goal
72%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. imageurl = "/images/products/" + item.id + "/" + item.productimage
  2. $.ajax({
  3.     url: imageurl,
  4.     type: 'HEAD',
  5.     error: function() {
  6.         //file not exists
  7.         imageurl = "/images/products/" + item.productimage
  8.     },
  9.     success: function() {
  10.         //file exists
  11.         imageurl = "/images/products/" + item.id + "/" + item.productimage
  12.     }
  13. });
  14. console.log('image: ' + imageurl);
RAW Paste Data
Top