Untitled

 avatar
unknown
plain_text
a month ago
708 B
5
Indexable
$(document).ready(function () {
    $("#dogForm").submit(function (e) {
        e.preventDefault(); // Prevent form from refreshing the page

        var dogName = $("#dogName").val();
        var breed = $("#breed").val();

        // Send data to process.php using AJAX
        $.post("process.php", { dogName: dogName, breed: breed }, function (response) {
            response = JSON.parse(response);
            if (response.success) {
                $("#dogImage").attr("src", response.image).show();
                $("#dogNameDisplay").text(dogName);
                $("#result").show();
            } else {
                alert("Error: " + response.message);
            }
        });
    });
});
Editor is loading...
Leave a Comment