index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. $(function(){
  2. // 筛选
  3. $('.a-btn').on('click',function(){
  4. var that = $(this);
  5. // $('.screen_box').hide();
  6. that.siblings('.screen_box').toggle();
  7. })
  8. // 省份选中效果
  9. $('.screen_city li').on('click',function(){
  10. var $this = $(this);
  11. $this.parent().siblings('.screen_are').animate({right:"0"});
  12. var oid = $this.attr('data-id');
  13. var _html = '<li data-id="0">不限</li>';
  14. $.ajax({
  15. type: "POST",
  16. url: "/public/getcity",
  17. data:{id:oid},
  18. dataType: "json",
  19. success: function(data) {//请求成功完成后要执行的方法
  20. if(data.code == 200){
  21. $.each(data.data,function(k,v){
  22. _html += '<li data-id="11">'+v.city_name+'</li>';
  23. })
  24. $('.screen_are ul').html(_html);
  25. }
  26. }
  27. });
  28. })
  29. //
  30. $('.screen_city li.cle').on("click",function(){
  31. var $this = $(this);
  32. $this.parent().siblings('.screen_are').animate({right:"-70%"});
  33. })
  34. // 选中
  35. $('.opt').on('click','li',function(){
  36. var that = $(this);
  37. var txt = that.text();
  38. that.parents('.screen_box').siblings('.a-btn').html(txt);
  39. that.parents('.screen_box').siblings('input').val(txt);
  40. that.parents('.screen_box').hide();
  41. })
  42. //报名验证及提交的调用
  43. PublicAction.AjaxSend(
  44. {
  45. CORID:'ap_btn', /*操作ID*/
  46. }
  47. );
  48. })