title: AJAX call returning data but failing
body: <p>I've been trying to make an ajax call to retrieve some data from a database but i don't know why is returning an error.</p>
  
  <p>there's the code</p>
  
  <pre><code>$('#afegir_pagament').submit(function() {
                          var import_pagament = $('#import_pagament').val();
                          var id_reserva = $('#id_reserva_hidden').val();
                          url = "afegir_pagament.php";
                          data = {import: import_pagament, id_reserva: id_reserva};
                          $.ajax({
                              url: url,
                              dataType: 'application/json',
                              type: 'post',
                              data: data,
                              complete: function(xhr, statusText) {
                                  console.log(xhr.responseText);
                              },
                              success: function(responseText) {
                                  $('#pag_import_pagat_propietari').val(responseText.total);
                              },
                              error: function(req, status, err) {
                                  alert('Error');
                              }
  
                          });
                          return false;
                      });
  </code></pre>
  
  <p>console.log(xhr.responseText) returns {"total":"230.00"} </p>
  
  <p>ERROR: no conversion from text to application/json</p>
  
  <p>Could somebody help me?</p>