$(document).ready(function () { $("#checkButton").click(function () { var url = $("#urlInput").val(); if (url.trim() === "") { alert("Please enter a URL."); return; } // Send request to Flask backend $.ajax({ type: "POST", url: "/predict", contentType: "application/json", data: JSON.stringify({ url: url }), success: function (response) { console.log("Server Response:", response); // Debugging // Update fraud score $("#result").html( `Base URL: ${response.base_url}
Fraud Score: ${response.fraud_score}%` ); // Display feature breakdown with percentages let featureList = "

Feature Breakdown

"; $("#features").html(featureList); }, error: function (xhr, status, error) { console.error("Error:", error); $("#result").html("Error processing the request."); } }); }); });