function that only takes an html structure and call it whenever we want to display that part of HTML dynamically : I have 3 pages that contains some blocks with the same structure, i don't want to repeat the same code several times, so what i want to do is a function that stock an html structure and which i call everytime i need to display that part of HTML dynamically. not sure how to do it correctly ..also what to use ajax call or Jquery ?

this is what i tried to do :

    function generateHtml() {
		var generateContent = '';
		generateContent += '<div id="blockAlarme" name="blockAlarme" clas="clsBlock">';
		generateContent += '<div id="blockAlarmeHeader" name="blockAlarmeHeader" class="clsBlockHeader">';
		generateContent += '<div class="clsBlockHeaderTitle">Alarme</div>';
		generateContent += '<div class="clsBlockHeaderReduce"></div>';
		generateContent += '</div>';
		generateContent += '<div id="blockAlarmeContent" name="blockAlarmeContent" class="clsBlockContent"></div>';
		generateContent += '</div>';
	}

and then i have to call it inside an html code that is appended by ajax so that it displays content

Thank you for your help :)
 