Problems connecting an Intel XDK application to the database

0

Good afternoon. I have the following problem: I created an application in intel xdk but I can not send the user registration data to the database in any way. I am using the wampserver. I looked at a tutorial on the internet and in the tutorial the guy used the same tools as me, but mine just does not work. I do not have much knowledge in php, I copied the class of the tutorial and I modeled it according to my application, I also took the class app.js and did the same thing. Is there something wrong with them?

class php:

<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: Application/html; charset-UTF-8");

$nome = $_POST['nome'];
$nickname = $_POST['nickname'];
$curso = $_POST['curso'];
$semestre = $_POST['semestre'];
$ra = $_POST['ra'];
$senha = $_POST['senha'];


$db = new mysqli("localhost","root","","aluno");

$sql = "insert into aluno values(NULL,'".$nome."', '".$nickname."', '".$curso."', '".$semestre."', '".$ra."', '".$email."', '".$senha."')";

$db->query($sql);
$db->close;

?>

Javascript

(function(){


"use strict";

function event_handlers(){

  $(document).on("click", "#envia", function(e){
   e.preventDefault();

          var recupera =  $("form#cadastro").serialize();
          var recupera = "http://localhost/app/apicadastro.php"
              $.ajax({
                  type: "POST",
                  url: url,
                  data: recupera,
                  async: false

              }).done(function(){

                 navigator.notification.alert("Dados inseridos com sucesso", null, "Sucesso", "OK");

              }).fail(function(){

                navigator.notification.alert("Falha!", null, "Falha", "OK");

              });


  });


}

document.addEventListener("app.Ready", event_handlers, false);


})();
    
asked by anonymous 23.04.2017 / 22:36

0 answers