How to call a perl script which is returning data "text" type inside a html file.Posting the perl script for reference.This script has to be called in the index.html so how to do that
#!/usr/bin/perl -w
use CGI;
my $cgi = CGI->new;
my $remote = $cgi->remote_host();
my $AB = "16.108";
my $CD = "16.214";
my $EF = "10.99";
my $GH = "10.243";
my $XY = "10.179";
my @remote_ip_values = split(/\./, $remote);
my $remote_ip = $remote_ip_values[0] .".". $remote_ip_values[1];
print "Content-type: text/html\n\n";
print "document.write(\"<style>\\n\");\n";
print "document.write(\"font color:red;\\n\");\n";
if ($remote_ip eq $AB)
{
print "document.write(\"SUCCESSFUL\");\n";
}
else
{
print "document.write(\"TEST\");\n";
}
exit;
I am editing my answer as I now understand what you are trying to do. I have set up a simple example which will load the content from "another website" - which for you will be your Perl CGI.
This HTML uses some simple JQuery. I am loading the following HTML page, http://chocksaway.com/tester.html and copying the contents into the "test" div:
http://chocksaway.com/tester.html has the following HTML:
If you open you http://chocksaway.com/tester2.html, you will see:
Replace "http://chocksaway.com/tester2.html" with the URL of your Perl CGI.