how to put variable inside append jquery -
script
javascript how put variable inside in append
$(function () { $(window).load(function () { $.ajax({ url: "/menu/getpagemenu", type: "get", success: function (data) { (var = 0; < data.length; i++) { var opt = new option(data[i].title, data[i].id); $('#target').append('<input type ="checkbox" name="menu">' + opt+ '</input>'); } } }); }); });
data not showing.
you can try this:
$(function () { $(window).load(function () { $.ajax({ url: "/menu/getpagemenu", type: "get", success: function (data) { (var = 0; < data.length; i++) { //var opt = new option(data[i].title, data[i].id); $('#target').append('<input type ="checkbox" name="menu" value="'+data[i].id+'">' + data[i].title+ '</input>'); } } }); }); });
Comments
Post a Comment