$('#cat_list').append('<li id="cat_' + cat_id + '">'
+ '<i class="ri-delete-bin-3-fill" onclick='removeLi(' + cat_id + ', "' + cat_title + '")'></i> ' + cat_title
+ '<input type="hidden" name="category[]" value="' + cat_id + '" /></li>');
document.write("<td width='74'><button id='button' type='button' onclick='myfunction(""+ name + "")'>click</button></td>")
//string should be in "", so you need to escape them!
document.write("<button id='button' type='button' onclick="getHistoryByYear('+ year + "," + '"' + string + '"' +')">click</button>")