0
负载数据不能够插入和使用负载数据的代码jQuery的AJAX插入并从数据库
$.ajaxSetup({
// Disable caching of AJAX responses
cache: false
});
$(function() {
$("#submit").click(function() {
var test = $("#txtarea").val();
var dataString = 'question=' + test;
if (test == '') {
alert("<h3>Please Enter Some Text</h3>");
} else {
$("#loading").show();
$("#loading").fadeIn(400).html('<span class="loading">Loading Comment...</span>');
$.ajax({
type: "POST",
url: 'q&a.php',
data: dataString,
cache: false,
error: function() {
$('#loading').html('<p>An error has occurred</p>');
},
success: function(html) {
$("#cm").after(html);
document.getElementById('txtarea').value = '';
document.getElementById('txtarea').focus();
$("#load").hide();
}
});
}
return false;
});
});
更多有关该问题的更多细节 – guradio
试图插入数据并使用此jquery ajax代码获取数据但不工作。 –
我正在尝试做相同的计算器'add comment'部分的作品 –