Firstly - your page is heavy, in the literal sense. Your code weighs a certain number of bytes, and you have this script repeated 540 times.
Secondly , when the HTML parser reaches the script tag, it will begin to parse it, blocking the rest of the html parsing, again you will have 540 times parsing the almost identical code
You have a bunch of identical elements on the page (say, input)
<input id='#buy10769' class='buy-input' data-id='10769' /> <input id='#buy10770' class='buy-input' data-id='10770' /> <input id='#buy10771' class='buy-input' data-id='10771' />
And your code, you can modify it.
$(document).ready(function(){ $('.buy-input').blur( function () { const $this = $(this) const id = $this.attr('data-id') const value = $this.val() $.ajax({ url: "/include/section/add-easy-cart.php", type: "POST", data: ({id, quantity : value}), success: function(res) {} }); if (value > 0) { document.getElementById('reload-cart').click(); } } }); });
Now, instead of 540 variants of your script, we have one. Which hangs up event handlers for each input, you can do without the data-id , then just make the id in the form of 10769