image not loading css code example

Example 1: css background image is not show change default picture

var imageURLs = $('div');
imageURLs.each(function(index, element){
    var imageURL = $(element).css('background-image').replace('url("', '').replace('")', '');
    if (imageURL != "none"){
        $.ajax({
           url: imageURL,
           type: 'HEAD',
           error: function(){
              //error handling for broken image url
           }
        });
    }
});

Example 2: background image in css is not working

background-image: url(nickcage.jpg); // first problem may be missing quotation mark
// Second may be wrong path 
// check the name of the file if there is any error
// check whether you are using proper extension of the file