When a user clicks on the Edit button, it should perform an Ajax request depending on the data attribute.
For example:
<button type="button" class="btn btn-danger btn-sm"
data-request-type="ajax:get"
data-request-url="/feature/edit"
>
Edit
</button>
In Ajax success callback, how to define to past success result into custom callback or into selector?
$.ajax({
type: requestMethod, //from data attribute
url: requestUrl, //from data attribute
success: function (data) {
},
});
I am thinking doing:
data-request-success-type="callback:functionName"
data-request-success-type="selector:className"
Or is there better approach?