Hi, create a one file webpage that uses html, php and javascript. The site uses html to…
- User
Hi, create a one file webpage that uses html, php and javascript. The site uses html to get a number from user, then using php it checks if the number is even or odd and displays the answer using javascript.
- Assistant
Sure! Here's an example of a one-file webpage that uses HTML, PHP, and JavaScript to check if a number entered by the user is even or odd.
<!DOCTYPE html> <html> <head> <title>Even or Odd Checker</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> </head> <body> <h1>Even or Odd Checker</h1> <form id="numberForm"> <label for="numberInput">Enter a number:</label> <input type="number" id="numberInput" name="numberInput" required> <button type="submit">Check</button> </form> <div id="resultMessage"></div> <script> $(document).ready(function() { $('#numberForm').submit(function(e) { e.preventDefault(); var number = $('#numberInput').val(); $.ajax({ url: 'check.php', method: 'POST', data: { number: number }, success: function(response) { $('#resultMessage').text(response); } }); }); }); </script> </body> </html>
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.