How do I make an AJAX request to Perl script using jQuery blur event?

后端 未结 2 1805
轻奢々
轻奢々 2021-01-16 07:11

I want to call an Perl script in the blur function of my input field. But i dont really know how to do this, and i cant find any working things with google. my code of the h

2条回答
  •  梦毁少年i
    2021-01-16 07:50

    You appear to have written a command line script, designed to be interacted with by a user running it in a shell. (The use of Getopt is a big clue here).

    In order to have it respond to an HTTP request you need to rewrite it so that it will work with a webserver (instead of a shell).

    There are several ways to do this. A simple approach would be to use CGI. A modern approach would be to use Plack, possibly in conjunction with a framework.

    A basic introduction to using Perl/CGI with Apache is available in the Apache documentation. You should look at a module such as CGI in order to process incoming data and emit HTTP headers correctly.

    You can find out more about Plack from the project's homepage, which includes links to a number of frameworks that use it.

提交回复
热议问题