jQuery와 POST를 사용하여이 양식을 제출하는 링크와 작은 양식이 있습니다. 프로세스 페이지의 HTML 출력을 AJAX를 사용하여 새로 고치지 않고 양식 페이지에 표시하고자합니다. 그러나 제출 링크를 클릭하면 내 코드가 작동하지 않는 것 같습니다. 누군가 내가 여기서 잘못하고있는 것을 지적 할 수 있습니까? 많은 감사합니다.jQuery에서 양식을 제출하는 링크를 사용하면 작동하지 않습니다.
감사
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#myform').submit(function() {
$.post('demoprocess.php', $("#myform").serialize(), function(data) {
$('#results').html(data);
});
});
});
</script>
<form name="myform" id="myform" action="" method="POST">
<label for="name" id="name_label">Name</label>
<input type="text" name="name" id="name" size="30" value=""/><br>>
<label for="email" id="email_label">Email</label>
<input type="text" name="email" id="email" size="30" value=""/><br>
<a href="#" title="" class="pay-button" style="margin-top:5px;" onclick="document.myform.submit()">SUBMIT</a>
</form>
<!-- We will output the results from demoprocess.php here -->
<div id="results"><div>
시도'SUBMIT' –
귀하의 코드는'})없는,'닫습니다'document.ready' 핸들러를 . 이것은 오타입니까? 그렇지 않으면 문제가 발생할 수 있습니다. –
감사합니다. Rory, 오타가 있었지만 작동하지 않습니다. – user1038814