Error adding more than one given mysql function in javascript intel XDK with PHP

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, beautiful, perfect wheel, but if I put some more field like, surname, it does not include anything in the surname. Look at the 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();
            }
        });
    });
    
asked by anonymous 17.01.2017 / 04:40

1 answer

1

I believe you're missing a & in your function.

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

Each field that you enter the most has to go by putting the & in the other variables.

    
23.01.2017 / 20:21