gbe*_*ard 1 javascript ajax json
我一直在尝试进行ajax调用以从数据库中检索一些数据,但我不知道为什么会返回错误.
有代码
$('#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;
});
Run Code Online (Sandbox Code Playgroud)
console.log(xhr.responseText)返回{"total":"230.00"}
错误:没有从文本到application/json的转换
有人能帮帮我吗?
| 归档时间: |
|
| 查看次数: |
2416 次 |
| 最近记录: |