Skip to content

Tag: laravel

how to pass $(this).data() in ajax request

i need to pass $(this).data into success func in ajax. here is my code But $(this).addClass(‘wishlist-comp-saved’); is not working inside success: function(data) {} Answer $(this) will change context when called. When inside of the success: function (data), $(this) is not the same as it was inside of whatever is calling this $.ajax() request. For your issue, you simply have to

How to use defer and make JS plugin working as well

When I use defer on app.js, there is a js plugin not working properly. If I remove defer, although the plugin works, but there is a warning to ask me to use defer, and I don’t know what to do. This is the test.blade.php If I use <script src=”{{ asset(‘js/app.js’) }}” defer></script>, then the x-mask plugin will not working. If

Access json data with Laravel and Inertia

I have a simple form with 1 input field and a submit button. All that does is get the user input, match it with an external API, and submit both records to the database. The response from the external API is JSON format, like this but I only want to retrieve the text field under choices This is stored in