0
이름을 제출할 때 내 URL이 리디렉션되는 양식을 만들었지 만 양식 작업 후에 내 모바일 유효성 검사 페이지로 리디렉션해야하는 양식을 만들었습니다. 코드를 입력 한 후 제안 페이지를 표시하고 싶습니다. 나는 아약스를 쓸 수 없다. 내 기능이 호출되지 않습니다. 다른 URL을 양식 작업에서 리디렉션하는 방법
는 jQuery를 버튼을 제출하기위한 기능과 트리거 클릭 이벤트를 onsubmit 쓰기 : 여기 당신이 뭔가를 할이를 위해 지금 http://plnkr.co/edit/3DA7YGb58BgcVcD0d10f?p=preview<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<form name="msform" action="another.html" method="post" id="msform">
<input name="name" type="text" placeholder="First Name" />
<input class="bl" id="submitbl" type="submit" value="Submit" />
</form>
<script type="text/javascript">
$("#submitbl").click(function(){
if($("#msform").valid() === true) {
var name = $('input[name|="name"]').val();
//use ajax to run the check
$.ajax({
type : 'POST',
url : 'mobile.html',
success: function(responseText){
resp = responseText.trim().substring(14);
if(resp == 'qualified') {
url_redirect({url: "offer.html",
method: "post",
data: { "fname": name }
});
}
}
});
}
});
</script>
</body>
</html>
을 mobile.html하는 아약스를 통해 성공 기능 리디렉션에 양식을 제출, 모든 AJAX를 사용하여 거의 지점이있다. –
제출 요청에서'e.preventDefault'를 확인하십시오 – Jagrati
또한 $ ("# msform")과 같은 jquery를 사용하여 작업을 변경할 수 있습니다. attr ("action", "/ Your URL here /"); –