I am finding myself doing a bunch of stuff over and over like creating event listeners and then using those event listeners to make AJAX calls using jquery
$.ajax function. Within those ajax calls depending on the outcome I create different modals that pop up using sweet alert 2. I’m writing all of this procedurally and it’s just taking up a ton of space and I’m essentially re-writing the same stuff over and over with only minor modifications. SOOOO it seems to me like I should be using OOP to reduce duplication but I’m struggling to find resources that show me how to write code for those use cases. Does anyone have suggestions / resources that I can look at so I can stop writing duplicate code and start writing reusable stuff?
PS I know the basics of OOP from a theoretical point of view, but I find it challenging to incorporate those in to the real world of web dev.