Ajax点击按钮查询数据

$('#Showmsg').click(function (e) {
        e.preventDefault();
        var _url = 'http://192.168.1.6:9500/Hotel';
        $.ajax({
            url: _url,
            type: 'GET',
            cache: false,
            processData: false,
            contentType: false
        }).done(function (data) {
            console.log('success,' + data);
            $(data).each(function (index, obj) {
                console.log("id=" + obj.Key);
                console.log("name=" + obj.Value);
                $("#HotelList").append("

" + obj.Value + "

"); }); }).fail(function (res) { console.log('fail,' + res); }); });

你可能感兴趣的:(Ajax点击按钮查询数据)