我有用于更新的表td并删除数据库,我想将我的td调用为javascript。我一直在尝试下面的代码,但我得到了未定义的值。我如何将我的td称为javascript?
这里是我的代码
<td class="action">
<div class="hidden-phone visible-desktop btn-group">
<form class="action" action="/news/{{$news_data->id}}" method="post">
<button class="btn btn-mini btn-info" type="button" onclick="window.location='/news/{{ $news_data->id }}/edit'">
<i class="icon-edit bigger-120"></i>
</button>
<button class="btn btn-mini btn-danger" id="delete" name="delete" href="#confirm-delete" data-toggle="modal" data-target="#confirm-delete">
<i class="icon-trash bigger-120"></i>
</button>
<input type="hidden" name="_token" value={{csrf_token() }}>
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<h4>Confirmation</h4>
</div>
<div class="modal-body">
<label><p id="id"></p>Are You Sure Want To Delete</label>
</div>
<div class="modal-footer">
<button class="btn btn-small btn-danger" id="delete" type="button">Delete</button>
<a data-handler="1" class="btn btn-small" data-dismiss="modal" >
<i class="icon-remove"></i> Cancel</a>
</div>
</div>
<input type="hidden" name="_method" value="delete">
</form>
</div> </td>
这里是javascript
<script type="text/javascript">
$(document).ready(function(){
$('#category_id').on('change', function(e){
var id_category = e.target.value;
$.get('{{ url('news/getid')}}/'+id_category, function(data){
console.log(id_category);
console.log(data);
$('#news_data').empty();
$.each(data, function(index, element){
$('#news_data').append("<tr><td>"+element.title+"</td><td>"+element.file+"</td>"+
"<td>"+element.content+"</td><td>"+element.like+"</td><td>"+element.view+"</td><td>"+find('.action') +"</td></tr>");
});
});
});
});
</script>