use jquery to add image in background-image code example
Example 1: add background image to div using jquery
var imageUrl = "images/sky.jpg";
$(".div_with_class").css("background-image", "url(" + imageUrl + ")");
Example 2: jquery set style background image
$('myObject').css('background-image', 'url(' + imageUrl + ')');