I would like to add stuff to body when I click on a checkbox, it’s ok, I found how to do.
My problem is that I just can add pure HTML, but I want to add Perl/CGI.
I explain:
$(function() {
$('input:checkbox').change(function(){
var nom = $(this).attr("value");
if ( $(this).is(':checked') ) {
$('body').append($("<div id="+nom+">Switch "+nom+"</div>"));
}
else {
$("#" + nom).remove();
}
});
Insetad of "<div id="+nom+">Switch "+nom+"</div>" can I append SwitchGUI->new("switch-rdc-7", 24, 2) ?
SwitchGUI is a perl module I’ve written, it execute a perl file, draw a switch, fill informations for each interface…
Here is SwitchGUI.pm
No. jQuery runs in the user’s browser, your perl code runs on your server; there’s no way for jQuery to inject perl code into the current page and have it run. If you need to run server-side code which has an effect on what the browser is displaying, use AJAX.