42
Technology

jQuery

jQuery is a JavaScript library which makes it easy for developers to search or manipulate within the DOM. For example, jQuery can be used for sliders or shopping carts to dynamically manipulate or replace content without reloading the web page.

Code Example:

$(document).ready(function() {
    $("#addToCard").click(function() {
        var prodId = $("#prodId").val();
        var units = $("#units").val();
        $.ajax({
            url: "/addToCard.php",
            type: "POST",
            data: {prodId: prodId, units: units},
            success: function(data) {
                // do something here
            }
        });
    });
});