SQL connection problem Cordova - Mysql

Hello community.

I’m trying to update a remote database from my cordova app. I’m getting a Javascrip execution permission error (This site requires javascript to work, please enable javascript in your browser). The connection works locally in server. .htaccess file has Header set Access-Control-Allow-Origin* defined in root directory where remote php is located. Any help is welcome, thanks in advance.

My app side code:

Carga DB

Connecting to Device

Device is Ready

Conectar a BD
Submit result

Backend code:

<?php header("Access-Control-Allow-Origin: *"); $con = mysqli_connect('DB_location','DB_user','DB_pass','DB') or die ('Imposible conectar');
        $firstname = $_POST['firstname'];
        $lastname = $_POST['lastname'];
        $sql = "INSERT INTO my_table (firstname, lastname) VALUES('$firstname','$lastname')";
        $result = mysqli_query($con,$sql);
        if($result) {
            echo $firstname." ".$lastname;
        else {
            echo "No se pudieron insertar los datos";