Jquery performance optimization
shape
$.ajax()
method in jQuery is used to perform asynchronous HTTP (AJAX) requests to load data from a web server without refreshing the page. It is a powerful and flexible function that allows you to interact with servers, send data, and receive responses in various formats like JSON, HTML, XML, or plain text. .animate()
function in jQuery is used to create custom animations on CSS properties of elements. It allows you to animate various properties, such as width, height, opacity, margin, padding, and more. The .animate()
method enables the creation of smooth transitions, providing a way to modify an element's CSS properties over a specified duration. $.ajaxSetup()
method in jQuery is used to set default values for all AJAX requests that are made on a page. It allows you to define global settings for AJAX requests, such as the default HTTP method, data type, timeout, or headers, so you don't need to specify them each time you make an AJAX request using methods like $.ajax()
, $.get()
, or $.post()
. .toggleClass()
method. This method checks if the class is already applied to the element and then adds it if it's not present, or removes it if it is. It's useful for creating interactive elements, like buttons or links, that change their style when clicked. .fadeIn()
and .fadeOut()
methods in jQuery are used to gradually change the opacity of an element, creating a smooth fading effect. These methods are commonly used for animating the visibility of elements on the web page, making the transition between visible and invisible states smooth and visually appealing. $(document).ready()
function in jQuery is used to run code as soon as the DOM (Document Object Model) is fully loaded, but before all the external resources (such as images, stylesheets, etc.) are completely loaded. This is particularly useful to ensure that your JavaScript and jQuery code is executed as soon as the HTML structure is available, which helps prevent errors caused by trying to manipulate elements that haven't been loaded yet.