Hope someone can advise.
I'm facing small issue trying to add certain data into a select
dropdown which is <option>
elements that I'm fetching it with Ajax
after clicking the check box in same td
in a table.
Html:
<td class="col-lg-4"><select name="name[]" class="form-control name"></select>
Now the JS:
$(document).on('click', '.check_box', function(){
var name = $(this).data('name');
$.ajax({
type: 'POST',
url: '/someactionhere/',
data:{name:name},
success: function(data){
$(this).closest('tr').find('.name').html(data);
}
});
});
I know it's should be real simple but and looks like right to me. So I don't no if something wrong or not.
Any ideas?
Thanks in advance.