如何使用从解析json数据获得的数据搜索数据库?
function on_jsondata(data) {
var docs = data.response.docs;
var searchText = data.response.docs[0].title; //search term
if(searchText) {
$.ajax({
url: 'db.php',
dataType: 'POST',
data: {'text': searchText},
success: function(html) {
$("#result").show();
$('#result').append(html);
}
});
}
}
答案 0 :(得分:0)
function on_jsondata(data) {
var docs = data.response.docs;
var searchText = data.response.docs[0].title; //search term
if(searchText) {
$.ajax({
url: 'db.php',
type: 'POST',
dataType: 'json',
data: {text: searchText},
success: function(html) {
$("#result").show();
$('#result').append(html);
}
});
}
}