switch statement in Jquery and List

前端 未结 4 829
余生分开走
余生分开走 2020-12-16 23:03

I would like to know if my approach is efficient and correct. my code is not working though, I don\'t know why.



        
4条回答
  •  执念已碎
    2020-12-16 23:30

    There are a couple changes that I'd make.

    Pull the HotelQuery function out of the ready function.

    Second all of those variables are going to be out of scope by the time you make the alert call. If you'd like them to be in scope, declare them globally (outside of your function) and set them inside the function.

    var name;
    
    function doStuff() {
      name = "reggie";
    }
    

提交回复
热议问题