Все,
У меня есть следующий код:
$(document).ready(function() {
$("#create_review").validate();
$("#submit_review_link").click(function() {
if ($("#create_review").valid()) {
$("#create_review").submit(function() { // catch the form's submit event
$.ajax({ // create an AJAX call...
data: $(this).serialize(), // get the form data
type: $(this).attr('method'), // GET or POST
url: $(this).attr('action'), // the file to call
success: function(response) { // on success..
alert("it is here");
$('#created').html(response); // update the DIV
}
});
return false; // cancel original event to prevent form submitting
});
}
return false;
});
});
Вот моя фактическая HTML-форма:
<form action="save_review.php" method="post" name="create_review" id="create_review">
<textarea name="review" id="review" rows="5" class="required"></textarea>
</form>
<a class="button-2" href="#" id="submit_review_link" onClick="submit_form()">Submit Review</a>
Я пытаюсь проверить это и затем отобразить результаты в моем созданном div. Это не работает, но я не уверен почему. Любые идеи очень приветствуются. Заранее спасибо.