in reply to Re: Simple example of CGI (Perl) + HTML + CSS + Javascript/jQuery + Ajax
in thread Simple example of CGI (Perl) + HTML + CSS + Javascript/jQuery + Ajax

Gotta say, I'm not impressed.

The point of my example was to illustrate Perl and jQuery. To that end, I'm intentionally showing how much you can do in a small number of lines of code. I realize JSON and the Template Toolkit are very useful -- I frequently use both for adding features to Bugzilla at work -- but there wasn't any need for them in an example specifically limited to Perl and jQuery.

On top of that, by "dumbing down" the functionality, your example does nothing more than calculate whether a number is even or odd. You can do that on the client in javascript; why would you need jQuery, Ajax, JSON, the Template Toolkit and a call to the server for that?!

say  substr+lc crypt(qw $i3 SI$),4,5
  • Comment on Re^2: Simple example of CGI (Perl) + HTML + CSS + Javascript/jQuery + Ajax

Replies are listed 'Best First'.
Re^3: Simple example of CGI (Perl) + HTML + CSS + Javascript/jQuery + Ajax
by rnewsham (Curate) on Aug 26, 2013 at 16:03 UTC

    I appreciate the point of your example, and it does do what you intended. However I believe its complexity could be daunting for a newcomer to perl, jquery or ajax in general. In my experience people who ask the question of how do I use X with Y want to see the most basic example of the core workings that they can apply to their own problem. They do not want to have to take a working example of hundreds of lines and have to strip out what is irrelevant to them.

    My example was not intended to do anything useful, interesting or impressive. It is purely a concise example of a jquery perl work flow. It was designed to be simple with only two files involved the one with the jquery and the one with the perl. That way the work flow can be easily tracked. As a demonstration to someone with limited prior knowledge of how jquery and perl can be used together, I do not believe that it needs to do any more.

    Template Toolkit was used as it keeps the html out of the perl and allows for the html output to be understood without executing any perl. JSON was used because I have found that this is by far the simplest way for perl to pass data back to jquery.

      I agree with you man, I really appreciate you dumbed down version. Even if it does just calculate something Javascript could do, it's a less daunting place for me to start. Many thanks!
Re^3: Simple example of CGI (Perl) + HTML + CSS + Javascript/jQuery + Ajax
by Anonymous Monk on Aug 26, 2013 at 21:36 UTC
    Maybe you want to get rid of  qw{ :standard };