When loading jquery ezmark checkboxes via Ajax, the style is not applied to them as when I load the page normally. Any idea what I can do to load it properly? The ajax code looks like below:
<script type="text/javascript">
function filter()
{
var data=$("#search-p").serialize();
$.ajax({
type: 'POST',
beforeSend: function() {
se.a.runtime.showSpinner();
},
complete: function() {
se.a.runtime.closeSpinner();
},
url: '<?php echo Yii::app()->createAbsoluteUrl("/search"); ?>',
data:data,
success:function(data){
//alert(data);
$('#pContent').empty();
var d1 = document.getElementById('pContent');
var createTable = "<form id='selectP' class='grow' method='post' action='<?php echo Yii::app()->request->baseUrl; ?>/index.php/show'>";
createTable += "<table class='static' style='width:1000px;'><thead><tr><th><b>Id</b></th><th><b>Status</b></th><th><b>Name</b></th><th><b>Type</b></th><th><label><input type='checkbox' name='select-all2' id='select-all' /></label></th></tr></thead><tbody>";
var tableContent = "";
$.each(data, function(i, val) {
createTable += "<tr>";
createTable += "<td>"+val.id+"</td>";
createTable += "<td>"+val.status+"</td>";
createTable += "<td>"+val.name+"</td>";
createTable += "<td>"+typee+"</td>";
createTable += "<td><label><input type='checkbox' name='id[]' value='"+val.id+"' class='round'></label></td>";
createTable += '</tr>';
});
createTable += '<tr align="right"><td colspan="7" style="text-align:right;"><input type="submit" name="yt0" value="Se statistik" /></td></tr>';
createTable += "</tbody></table></form>";
d1.insertAdjacentHTML('beforeend', createTable);
},
error: function(data) { // if error occured
alert("Error occured.please try again");
alert(data);
},
dataType:'json'
});
}
call following function after ajax call
RépondreSupprimer$('input[type="checkbox"]').ezMark();