I have a code block in my jsp page. I want use this code in ajax with append tag. Here is my code.
for ( var i = 0, len = data.length; i < len; ++i) {
  var listValue = data[i];
  $('.flowers').append(
    '<div class="profile-sidebar" style="width: 250px;">\
      <div class="portlet light profile-sidebar-portlet" \
        data-category="listValue.officeNameNoSpace"> \
        <div class="profile-userpic"> \
          <img src="listValue.imgPath" class="img-responsive" \
          alt=""> \
        </div> \
        <div class="profile-usermenu"></div> \
      </div> \
    </div>'
  );
}
But it still has error.Here is error :
String literal is not properly closed by a matching quote
I tried this way.:
for ( var i = 0, len = data.length; i < len; ++i) {
  var listValue = data[i];
  $('.flowers').append(
    '<div class="profile-sidebar" style="width: 250px;">
      <div class="portlet light profile-sidebar-portlet"
        data-category="listValue.officeNameNoSpace">
        <div class="profile-userpic">
          <img src="listValue.imgPath" class="img-responsive"
          alt="">
        </div>
        <div class="profile-usermenu"></div>
      </div>
    </div>'' +
');
What should i do? Thanks.
 
     
    