I'm using a JavaScript plugin to get the IP address. If the IP address starts with 10.15 I want to assign one value to a variable, and if the IP starts with 10.13 I want to assign a different value to the same variable.(I don't know if the variable has to be in Perl or JavaScript)
I'm trying this but is not working.
my $propt = "";
getUserIP(function(ip) {
console.log('IP: ' + ip);
const ips = ip.split('.');
var pro = document.getElementById('property');
console.log(pro);
if (ips[0] === "10" && ips[1] === "15") {
pro.value = "propt1";
To_Here
$propt = "SRC";
print <<"To_Here";
}
else if(ips[0] === "10" && ips[1] === "13") {
pro.value = "propt2";
To_Here
$propt = "ACC";
print <<"To_Here";
}
else {
pro.value = "propt";
To_Here
$propt = "TAP";
print <<"To_Here";
}
console.log(pro);
First I tried passing the value to an HTML input and reading the value of the input but I don't know if this is possible in Perl
<input id="property" type="hidden" name="property" value=""/>
The final step of what I'm trying to do is to run a query based on the property
$ql = "Select from properties where property = '?????' <----
print <<"To_Here"and endingprint <<"To_Herestatements? And shouldn'tTo_Herebe flush to the left margin? Or am I misunderstanding you completely?