我试图在按钮上调用onclick事件,我在我的代码中也使用了struts标签,当我尝试点击按钮时,onclick事件没有被触发。下面是代码。帮助我解决这个问题。在此先感谢
function validateUser(){
alert("Hi");
$.ajax({
traditional: true,
type: "POST",
url: 'ajaxlogin.action?username='+$('username').val()+'&password='+$('password').val(),
dataType: 'text',
success: function(data){
console.log(stringify(data));
}
});
}
</script>
</head>
<body>
<div id="wrap">
<div class="section" id="section1">
<div class="login-form">
<s:form method="" action="" cssClass="form-wrapper-01">
<s:textfield theme="simple" cssClass="inputbox email" id="username" name="username" placeholder="User Name" />
<s:password theme="simple" cssClass="inputbox password" id="" name="password" placeholder="Password" />
<p><s:submit theme="simple" cssClass="button" id="button" value="SIGN IN" onclick="validateUser()" /></p>
</s:form>
</div>
</div>
</div>
</body>
</html>