新手问题 神奇问题

ckl · April 13, 2014 · Last by ckl replied at April 13, 2014 · 1771 hits
padding_data = (house_id) ->
    $.get "/houses/list_house_edit/" + house_id, (data) ->
      $(".house_type option").each ->
        $(this).attr "selected", true  if $(this).val() is data.house_type_id

为什么 if 判断进不去

这缩进大丈夫?

#1 楼 @Rei 我第二个 get 需要用到第一个得到的 json 数据,所以????

第二个get()的判断 是个什么东西?

#3 楼 @Kabie 我这里是做 select 的选择,判断里面的 val 等于 get 的数据,所以

我知道原因了,is 翻译成==,要求两个数据类型一样。只要加一个.toString() 就可以了。 谢谢两位

You need to Sign in before reply, if you don't have an account, please Sign up first.