需要jQuery问题帮助 [英] JQuery Problem Help required

查看:73
本文介绍了需要jQuery问题帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在申请,我有一个文本框和一个输入文本并按Enter的按钮,它应该将电子邮件发送到输入的电子邮件地址.我使用类似
的jquery keydown事件来执行此操作

I am making an application,i have a textbox and a button on entering text and pressing enter,it should send email to the entered email address. I doing this with jquery keydown event like

$("#txtverfyemail").live("keydown", function (event) {
        if (event.keyCode == '13') {         
            SendEmail();       
        }
    });


 function SendEmail() {
        email = $('#txtverfyemail').val();
        a = true;
        if (email == "" || email == null) {
            ErrorDivText('Enter email address');
            a = false;
        }
        if (a) {
            if (!validateEmail(email)) {
                ErrorDivText('Enter a valid email address');               
            }
            else {
                VerifyEmail(email);
            }
        }
    }


我的控制器名称是UserRegistration,我要重定向的操作是VerifyEmail,当我输入无效的电子邮件时,它会检查有效的电子邮件并显示错误消息msg,但突然出现错误IControllerFactory"Web.Mvc.SpringControllerFactory"没有为该控制器返回控制器名称为"VerifyEmail".

当我看到URL时,它变成http:\ localhost:4000 \ VerifyEmail \ UserRegistration

如果我输入有效的电子邮件,则会出现相同的错误,它会向电子邮件发送成功的消息msg,然后突然出现错误,我想知道将控制器名称与Actionname交换的方式和位置,即使在我未命中控制器的情况下,


My Controller name is UserRegistration and the action i am redirecting is VerifyEmail, When i enter an invalid email it checks for valid email and print error msg but suddenly gives error The IControllerFactory ''Web.Mvc.SpringControllerFactory'' did not return a controller for the name ''VerifyEmail''.

and when i see URL it becomes http:\localhost:4000\VerifyEmail\UserRegistration

The same error is arising if i enter a valid email,it sends email display success msg then suddenly gives error i am wondering how and where it is swaping controller''s name with Actionname,Even in the situation when i am not hitting controller

推荐答案

(" ) .live(" ,函数(事件){ 如果(事件 .keyCode == ' 13'){ 发送电子邮件(); } }); 函数SendEmail(){ email =
("#txtverfyemail").live("keydown", function (event) { if (event.keyCode == '13') { SendEmail(); } }); function SendEmail() { email =


(' #txtverfyemail').val( ); a = true ; 如果(电子邮件== " | | email == ){ ErrorDivText(' 输入电子邮件地址'); a = false ; } 如果(a){ 如果(!validateEmail(email)){ ErrorDivText(' 输入有效的电子邮件地址'); } 其他 { VerifyEmail(email); } } }
('#txtverfyemail').val(); a = true; if (email == "" || email == null) { ErrorDivText('Enter email address'); a = false; } if (a) { if (!validateEmail(email)) { ErrorDivText('Enter a valid email address'); } else { VerifyEmail(email); } } }


我的控制器名称是UserRegistration,我要重定向的操作是VerifyEmail,当我输入无效的电子邮件时,它会检查有效的电子邮件并显示错误消息msg,但突然出现错误IControllerFactory"Web.Mvc.SpringControllerFactory"没有为该控制器返回控制器名称为"VerifyEmail".

当我看到URL时,它变成http:\ localhost:4000 \ VerifyEmail \ UserRegistration

如果我输入有效的电子邮件,则会出现相同的错误,它会发送成功的电子邮件显示消息,然后突然出现错误,我想知道如何以及在何处将控制器名称与Actionname交换,即使在我未点击控制器的情况下,


My Controller name is UserRegistration and the action i am redirecting is VerifyEmail, When i enter an invalid email it checks for valid email and print error msg but suddenly gives error The IControllerFactory ''Web.Mvc.SpringControllerFactory'' did not return a controller for the name ''VerifyEmail''.

and when i see URL it becomes http:\localhost:4000\VerifyEmail\UserRegistration

The same error is arising if i enter a valid email,it sends email display success msg then suddenly gives error i am wondering how and where it is swaping controller''s name with Actionname,Even in the situation when i am not hitting controller


使用keydown…键码13…真是个坏主意.首先,如果您进行了工作,它将使用户意外,导致意外发送.为什么不使用常规按钮?而且,顺便说一下,带有"post" HTTP请求的常规Web表单也不是. HTTP请求在哪里?您应该使用Ajax或Web表单.

甚至不要考虑在客户端验证数据的想法.如果不更糟的话,这很容易使您的主机变成发送垃圾邮件的僵尸.您应该确实对其进行很好的验证,并且只能在服务器端进行验证.

我在过去的回答中解释了这种危险:
无法发送邮件,它显示了以下代码中的错误. [
Using keydown… key code 13… really bad idea. First of all, if you make if working, it would be unexpected by the user, cause accidental sends. Why not using a regular button? And, by the way, not regular Web form with the "post" HTTP request. And where is you HTTP request? You are supposed to use Ajax or a Web form.

Don''t even play with the idea to validate data on the client side. It''s way to easy to turn your host into a zombie sending spam if not worse. You should really validate it well, and only on the server side.

I explain the danger in my past answer:
unable to send mail , it showing the error in below code .[^].

Please take it very seriously! This is a real danger which could be fatal to your site! I know it from real life.

Take care,
—SA


这篇关于需要jQuery问题帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆