0

如何使用从解析 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);
            }
        });
    }
 }
4

1 回答 1

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);
                }
            });
    }
 }
于 2013-05-20T13:10:12.237 回答