title: SyntaxError: Unexpected end of JSON input
body: <p>I can record data in my db but ajax loading doesn't inter in success method. What's the problem?</p>
  
  <pre><code>error: "SyntaxError: Unexpected end of JSON input
      at Object.parse (native)
      at n.parseJSON "
  </code></pre>
  
  <p><strong>record_data.php</strong></p>
  
  <pre><code>&lt;?php
  $type=getPar_empty("type",$_GET,"");
  $new_nome=$_GET['new_nome'];
  $new_cognome=$_GET['new_cognome'];
  $new_email=$_GET['new_email'];
  $new_lingua=$_GET['new_lingua'];
  if ($type=="add_user"){
    $stmt=null;
    $stmt=$db-&gt;prepare("INSERT INTO newsletter_utenti(email,abilitato,nome,cognome,lingua,lista,data_creazione,unsubscribe) VALUES('$new_email',1,'$new_nome','$new_cognome','$new_lingua','manual',now(),0)");
    if (!$stmt) {
      log_msg($db-&gt;error);
      die();
    }
    $stmt-&gt;execute();
    $stmt-&gt;close();
    $db-&gt;close();
  }
  ?&gt;
  </code></pre>
  
  <p><strong>script</strong></p>
  
  <pre><code>   $("#salvaBtn").click(function(){
    var nome = $('#nome').val();
    var cognome = $('#cognome').val();
    var email = $('#email').val();
    var lingua = $('#lingua').val();
    var dataString = 'nome='+nome+'&amp;cognome='+cognome+'&amp;email='+email+'&amp;lingua='+lingua+'&amp;type=add_user';
    $.ajax({
      type:'GET',
      data:dataString,
      url:"record_data.php",
      success:function(result) {
                $("#status_text").html(result);
                $('#nome').val('');
                $('#cognome').val('');
                $('#email').val('');
      },
      error:function(xhr,status,error) {
        console.log(error);
      }
    });
  });
  
  $('#adduser').submit(function (){
    return false;
  });
  </code></pre>
  
  <p><strong>form</strong></p>
  
  <pre><code>&lt;form name="adduser" id="adduser" method="GET" action="#"&gt;
              &lt;div class="col-md-3"&gt;
                &lt;div class="form-group m-b-30"&gt;
                  &lt;p&gt;E-mail&lt;/p&gt;
                  &lt;input class="form-control" type="email" id="email" name="email" placeholder="indirizzo e-mail" email required&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="col-md-3"&gt;
                &lt;div class="form-group m-b-30"&gt;
                  &lt;p&gt;Nome&lt;/p&gt;
                  &lt;input class="form-control" type="text" id="nome" name="nome" placeholder="nome"&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="col-md-3"&gt;
                &lt;div class="form-group m-b-30"&gt;
                  &lt;p&gt;Cognome&lt;/p&gt;
                  &lt;input class="form-control" type="text" id="cognome" name="cognome" placeholder="cognome"&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="col-md-3"&gt;
                &lt;div class="form-group m-b-30"&gt;
                  &lt;p&gt;Lingua&lt;/p&gt;
                  &lt;select class="form-control" id="lingua" name="lingua"&gt;
                    &lt;option value="it"&gt;IT&lt;/option&gt;
                    &lt;option value="en"&gt;EN&lt;/option&gt;
                  &lt;/select&gt;
                &lt;/div&gt;
                &lt;input type="submit" class="btn btn-embossed btn-primary m-r-20" id="salvaBtn" value="Aggiungi utente"&gt;&lt;/input&gt;
                &lt;div id="status_text" /&gt;&lt;/div&gt;
              &lt;/div&gt;
            &lt;/form&gt;
  </code></pre>