가능한 중복 :
jQuery/Javascript function to clear all the fields of a form아약스/JS를 사용하여 양식을 취소하는 방법
난 후 제출하지만 방법 중 어느 것도 내가 나를 위해 작품을 본 적이 양식을 삭제해야 . 구입 한 스크립트를 사용하고 있지만 작성자가 내 요청에 응답하지 않습니다. JS 파일은 다음과 같습니다.
$('#contact_form').submit(function() {
$.ajax({
type: 'POST',
url: 'contact.php',
data: {
name: $('#contact_form input#name').val(),
email: $("#contact_form input#email").val(),
text: $("#contact_form textarea").val()
},
success: function(data) {
if (data == 'sent') {
$('#contact_form .status').html('Thanks');
} else if (data == 'invalid') {
$('#contact_form .status').html('Invalid.');
} else {
$('#contact_form .status').html('Can't send message.');
}
},
error: function() {
$('#contact_form .status').html('Can't send message.');
}
});
return false;
});
}
나는 대답,하지만 내가 전에이 - (http://stackoverflow.com/questions/6653556/jquery-function-to-clear-all- [폼의 모든 필드를 지우려면 jQuery를 기능] the-fields-of-a-form) –
그것은 이스케이프 처리되지 않은 아포스트로피와 관련이있을 수 있습니다. ''메시지를 보낼 수 없습니다. '''메시지를 보낼 수 없습니까?'또는''메시지를 보낼 수 없습니다. '' –
그보다는 당신이 스크립트를 수정하십시오. 즉, 스크립트를 구입했다면 제작자가 모든 수정 권한을 보유해서는 안됩니까? 당신은 당신이 무엇인가하기 전에 그것을 확인하고 싶어 할지도 모릅니다. 발진. – Palladium