ajax call in laravel blade

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>

<script>
$(document).on('click', 'a[data-ajax-popup="true"], button[data-ajax-popup="true"], div[data-ajax-popup="true"]', function ()
{

var title1 = $(this).data('title');
var title2 = $(this).data("bs-original-title");
var title = (title1 != undefined) ? title1 : title2;
var size = ($(this).data('size') == '') ? 'md' : $(this).data('size');
var url = $(this).data('url');
var id = $(this).data('id');
var type = $(this).data('type');
$("#commonModal .modal-title").html(title);
$("#commonModal .modal-dialog").addClass('modal-' + size);
$.ajax({
url: url,
data: { id: id,type:type} ,
success: function (data) {
$('#commonModal .body').html(data);
$("#commonModal").modal('show');
},
error: function (data) {
data = data.responseJSON;
}
});

});

</script>


<a href="#" data-size="lg" class="btn btn-danger"
data-id="{{ $data->id }}" data-url="{{ route('admin.ajax-property') }}"
data-type="Delete" data-ajax-popup="true" data-bs-toggle="tooltip"
title="{{__('Delete')}}" >
Delete
</a>


 

No comments:

Post a Comment

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...