I am trying to replace the value of data in span
.ajax ({
.
.
.
success: function(data){
$("#ID1").html(data[0]);
$("#ID2").val(data[1]);
}
});
<span id ='ID1'>test</span>
<input id = 'ID2'>
return data is [["abc"],["def"]] using json_encode ID1 is not changing test to abc while value of ID2 is able to change to def what is wrong?
Use $("#ID1").html(data[0])
instead of $("#ID1").val(data[0]);