为什么我的.post和hide(“幻灯片”)会出现jQuery语法错误?

时间:2022-07-17 22:31:09

After I do the .post thing, I want to hide the first div with a left slide, then show the second with a right slide. My right-slide was working fine and then I went and tried to put in the left slide and I broke it all.

在我执行.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);
                });
            }
        );
    }

3 个解决方案

#1


I'm not sure what the extra function() is doing, maybe try removing that?

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

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);
        }
    );
 }

#2


You've got an extraneous function block in there. Try this instead:

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

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);
        }
    );
}

#1


I'm not sure what the extra function() is doing, maybe try removing that?

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

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);
        }
    );
 }

#2


You've got an extraneous function block in there. Try this instead:

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

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);
        }
    );
}