回覆列表
  • 1 # 使用者834195712159

    <select>

    </select>

    $(document).ready(function () { //此處頁面開啟即請求api

    $.ajax({

    type:"GET",

    url:"{:url("Room/houseData")}",

    contentType: "application/json; charset=utf-8",

    async : true ,

    dataType: "json",

    success: function (date) {

    var optionstring = "";

    for (var j = 0; j < date.length;j++) {

    console.log(date[j].house_name);

    console.log(date[j].id);

    optionstring += "<option value=\"" + date[j].id + "\" >" +date[j].house_name+" " + "</option>";

    $("#select").html("<option value="0">請選擇...</option> "+optionstring);

    }

    },

    error: function (msg) {

    layer.msg("資料出錯了!!");

    }

    });

    });

  • 中秋節和大豐收的關聯?
  • 手心腳心熱是怎麼回事?