사용자 이름과 비밀번호가있는 HTML 양식이 있습니다. 제출 버튼을 클릭하면 두 개의 서로 다른 서버에서 두 가지 다른 PHP 메소드에 게시하려고합니다. 어떻게 할 수 있습니까? HTML 폼을 사용하여이 작업을 수행 할 수 있습니까? 아니면 자바 스크립트를 사용해야합니까? 어떤 제안?단일 양식에서 다른 두 가지 방법으로 게시하십시오.
UPDATE는 다음 코드를 시도했지만 작동하지 않습니다. 내가 여기서 뭐라구? 미리 감사드립니다 ..!
<!DOCTYPE html><!--HTML5 doctype-->
<html>
<head>
<title id="login_form">Login Form testing</title>
<script type="text/javascript" src="//code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$('#loginform').submit(function(){
$("form").on("submit", function(event) {
event.preventDefault(); // prevent the default submission behavior
var data = $(this).serialize(); // gather data from the form and serialize it
$.post('URL_1', data, successAction1); // post it to destination 1
$.post('URL_2', data, successAction2); // post it to destination 2
});
var successAction1 = function() { alert("Success one");};
var successAction2 = function() { alert("Success two");};
});
</script>
</head>
<body>
<form id="loginform" action="">
<fieldset >
<legend>Login</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<label for='username' >UserName*:</label>
<input type='text' name='username' id='username' maxlength="50" />
<label for='password' >Password*:</label>
<input type='password' name='password' id='password' maxlength="50" />
<input type='submit' name='Submit' value='Submit' />
</fieldset>
</form>
</body>
왜 그렇게하고 싶습니까? –
왜 1 대의 서버에 게시하고 다른 곳으로 가야 할 데이터의 부분을 보내야합니까? –
@EliasVanOotegem 그의 호스트가 서버 측 스크립팅을 허용하지 않을 수 있습니까? – Mr47