Error including more than one mysql data in intel XDK javascript with PHP

Asked

Viewed 58 times

1

I’m using the following function:

$( document ).ready(function() {
    var $server;
    $server = 'http://localhost/mobile/DatabaseXDK/database/www/';

    $('#inclusao').on('click', function(){
        $nome = $('#nome').val();
        $.ajax({
            type: "get",
            url: $server+"/conexao.php",
            timeout: 3000,
            contentType: "application/json; charset=utf-8",
            data: "nome="+$nome+"&acao=inclusao",
            success: function(data) {
                intel.xdk.notification.alert('Pessoa Cadastrada!','Inclusao','ok');
                Pessoas();
            }
        });
    });

Until then beauty, perfect wheel, but if I put some more field as, surname, does not include anything in the surname. See function:

$( document ).ready(function() {
    var $server;
    $server = 'http://localhost/mobile/DatabaseXDK/database/www/';

    $('#inclusao').on('click', function(){
        $nome = $('#nome').val();
        $sobrenome = $('#sobrenome').val();
        $.ajax({
            type: "get",
            url: $server+"/conexao.php",
            timeout: 3000,
            contentType: "application/json; charset=utf-8",
            data: "nome="+$nome+"sobrenome"+sobrenome+"&acao=inclusao",
            success: function(data) {
                intel.xdk.notification.alert('Pessoa Cadastrada!','Inclusao','ok');
                Pessoas();
            }
        });
    });
  • 2

    Shouldn’t be "nome="+$nome+"&sobrenome"+sobrenome+"&acao=inclusao" see that there is a & before the surname.

  • It seems you forgot the dollar and the & "name="+$name+"&last name"+$last name+"&action=inclusion",

1 answer

1


I believe one is missing & in his role.

nome="+$nome+"&sobrenome"+sobrenome+"&acao=inclusao" 

Every field you enter the most has to go putting the & in the other variables.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.