I have a script that returns data as json and displays it inside an alert box. What I want to do is display each line of the data as a list.
I have (with help) managed to produce some code that performs this task only if there data has one object per row using the code below:
<ul><li>'+result.join('</li><li>')+'</ul>'
But, if the returned json has multiple objects per row I get the following error: Uncaught TypeError: result[3].join is not a function at Object.success.
The code that is causing this error is:
<ul><li>'+result[0]+'<br/>Room: '+result[1]+'<br/>Between: '+result[2]+' and '+result[3].join('</li><li>')+'</ul>
Can anyone see where I have gone wrong and if possible provide a way in which the returned json data can be displayed as list items. The complete ajax code is:
$.alert({
  type: 'red',
  title: 'Error: Room booking period overlap ',
  content: 'Client: <ul><li>'+result[0]+'<br/>Room: '+result[1]+'<br/>Between: '+result[2]+' and '+result[3].join('</li><li>')+'</ul>',
  'fa fa-rocket',<ul><li>'+result.join('</li><li>')+'</ul>'
   animation: 'zoom',
   boxWidth: '50%',
   closeAnimation: 'zoom',
   buttons: { 
     Close: function() {
       text: 'Close'
     }
  }
}) 
Many thanks in advance for your time.
