Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: CGI ajax repeating input

by stonecolddevin (Vicar)
on Oct 19, 2009 at 18:49 UTC ( #802067=note: print w/replies, xml ) Need Help??


in reply to CGI ajax repeating input

Check out jQuery. It'll make your ajax usage a *ton* easier.

mtfnpy

Replies are listed 'Best First'.
Re^2: CGI ajax repeating input
by tswall (Monk) on Oct 19, 2009 at 20:39 UTC

    I agree that using jQuery or any of a number of other JavaScript AJAX-type libraries on the client side would make your life a lot easier (script.aculo.us, prototype, Cappuccino, just to name a few. There are a bunch out these days).

    As far as your code is concerned...your Perl looks sound and simple...although I haven't done a lot of CGI work. What about:

    <input id='inputfield' name='word' type='text' class='cmdline' autocom +plete='off' value="" onkeydown = 'if(window.event.keycode == 13){Java +Script:xmlhttpPost("/cgi-bin/test1.cgi")}' />
    Does the event keycode make any difference? Do you know that the CGI script is called with each tab?

    Also, I think your response CAN have a header...although I'm not sure it needs one...seems like I've sent back just raw text before in as an AJAX response. But that is what all the wonderful frameworks out there help nicely with.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://802067]
help
Chatterbox?
[Your Mother]: :P
[LanX]: Moma knows best! ;-)
[Your Mother]: I am quite aware that Module::Build is MUCH more in favor with many monks but I had trouble with it every time I tried to use it and trouble with CPAN stuff that used it too.
[Your Mother]: Take my advice with a grain of salt. I haven't done a new CPAN release in years at this point.
[LanX]: I want to author a new module for CPAN w/o complicated build structure
[LanX]: ther is also Dist::Zilla :-/
[LanX]: How to make a CPAN Module Distribution from 2002
[Your Mother]: Dist::Zilla is kind of the nuclear option. I set it up back in the day but it's really targeted at authors who are managing MANY modules and want to automate everything.
[erix]: perlancar should know ;)
[LanX]: see warning

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2017-08-18 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (306 votes). Check out past polls.

    Notices?