function submitticketdeals() { var emailaddr = $("form[ name='ticketdeals'] input[name='emailaddress']").val(); var language = $("input[name='language']").val(); var patterns = /^[_a-za-z0-9.\-]+@([_a-za-z0-9]+\.)+[a-za-z0-9]{2,3}$/; if (patterns.test(emailaddr)) { $.ajax({ type: "post", url: "/www/servlet/com.ace.portal.biz.email.servlet.submitemail", datatype : "json", data:{emailaddress:emailaddr,language:language} , success: function(data){ if(data=='true'){ $("#mydialogtest").trigger("click"); }else{ $("#dialog").css("background","url(/www/images/email_no.jpg)"); $("#mydialogtest").trigger("click"); $("form[ name='ticketdeals'] input[name='emailaddress']").val(""); return false; } } }); } else { alert("电邮验证错误,请重新输入!"); $("form[ name='ticketdeals'] input[name='emailaddress']").focus(); } }