【问题标题】:Why do I get a jQuery syntax error with .post and hide("slide")?为什么使用 .post 和 hide("slide") 时会出现 jQuery 语法错误?
【发布时间】:2009-03-30 15:26:45
【问题描述】:

在完成 .post 之后,我想用左幻灯片隐藏第一个 div,然后用右幻灯片显示第二个 div。我的右滑轨工作正常,然后我去尝试放入左滑轨,但我把它弄坏了。

if(hasError == false) {
    $.post("/process-email-signups",{email_address: email_addressVal},
        function(data){
            $("#email_signup_form").hide("slide", { direction: "left" }, 1000); 
                function() {
            $("#thank_you_message").show("slide", { direction: "right" }, 1000);
                });
            }
        );
    }

【问题讨论】:

    标签: javascript jquery syntax


    【解决方案1】:

    你有一个无关的功能块在那里。试试这个:

    function(data){
                    $("#email_signup_form").hide("slide", { direction: "left" }, 1000); 
    
                    $("#thank_you_message").show("slide", { direction: "right" }, 1000);
    
                    }
            );
    

    【讨论】:

      【解决方案2】:

      我不确定额外的 function() 正在做什么,也许尝试删除它?

      if(hasError == false) {
          $.post("/process-email-signups",{email_address: email_addressVal},
              function(data){
                      $("#email_signup_form").hide("slide", { direction: "left" }, 1000); 
                      $("#thank_you_message").show("slide", { direction: "right" }, 1000);
              }
          );
       }
      

      【讨论】:

        【解决方案3】:
        if(hasError == false) {
            $.post("/process-email-signups", {email_address: email_addressVal},
                function(data){
                        $("#email_signup_form").hide("slide", { direction: "left" }, 1000); 
                        $("#thank_you_message").show("slide", { direction: "right" }, 1000);
                }
            );
        }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2022-01-20
          • 2012-09-20
          • 1970-01-01
          • 2021-11-13
          • 2022-08-03
          • 1970-01-01
          • 1970-01-01
          • 2013-11-09
          相关资源
          最近更新 更多