0
I want Define url Like this
var id = $('#id').val();
url: "category/(my difined id varibale here)/edit"
どうすればいいですか?私はどのように私のAjaxのURLでJavaScript変数を定義できますか
私は私が私のコントローラ機能
This is the script part where I use ajax to insert data to database
<script>
$(document).ready(function(){
$(document).on('click','#edit',function(){
$('#modelTile').text('Edit Category');
$('#addItem').val($(this).data('name'));
$('#id').val($(this).data('id'));
$('#yesdelete').hide();
});
$('.modal-footer').on('click','#saveChange',function(){
var name = $('#addItem').val();
var id = $('#id').val();
var token ='{{csrf_field()}}';
$.ajax({
method : 'post',
url : "category/{'id'}/edit",
});
conlose.log (url);
});
});
</script>
にあなたのコードを交換して取得するURLのこの種を必要とする理由私は非常だとリソースコントローラを使用し、ここでLaravel 5.4 を使用してプロジェクトを作成していますあなたに感謝します。 :)ありがとう –