1

Hello I am trying to develop a simple webpage using CGI on the server side. My current goal is to submit a form without reloading the page via Ajax.

The CGI in Python:

#!/usr/bin/env python2

print("Content-Type: text/html \n\n")

f = open("ajax_input.html", "r")
print(f.read())

The Current Webpage:

<!DOCTYPE html>
<html>



        <script>
                $('form.ajax').on('submit', function(){
                        alert("Success")
                        return false;


                });
        </script>

        <body>
                <form method="post" class="ajax">
                        <input type="submit" value="Submission">
                </form>
                <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

        </body>
</html>
Barmar
  • 741,623
  • 53
  • 500
  • 612

0 Answers0