嗨,我有这个简单的代码:
var datastring="123";
$.ajax({
url: 'actualizarimagen.php',
type: 'post',
dataType: 'text',
data: datastring,
cache: false,
success: function(response){
$('.msg1').html(response);
},
error: function(response){
$('.msg1').html(response);
}
});
在actualizariimagen.php 中:
$desc_larga = print('<pre>') & print_R($_POST) & print('</pre>');
$insertSQL = sprintf("INSERT INTO prueba (texto) VALUES ($desc_larga)");
我收到成功消息,但在数据库中始终保存 1。我尝试更改所有内容,dataType,成功,错误,完整功能,但它不起作用。我正在搜索,但任何答案都无济于事。
谢谢。
编辑:添加响应