我有以下脚本:
<script>
/* attach a submit handler to the form */
$("#Submitter<? echo $count; ?>").submit(function(event) {
/* stop form from submitting normally */
event.preventDefault();
/*clear result div*/
$("#result").html('');
/* get some values from elements on the page: */
var values = $(this).serialize();
/* Send the data using post and put the results in a div */
$.ajax({
url: "<? echo Configure::read('Burl') . $cat['sub_cat_url']; ?>",
type: "post",
data: values,
success: function(){
$("#prod_add").show();
$("#prod_add").delay(2500).animate({opacity: 0},5000);
},
error:function(){
alert("failure");
$("#result").html('there is error while submit');
}
});
});
</script>
哪个有效,表格已发布。但是如何在不刷新的情况下访问同一页面上的帖子变量?它们是否存储在 JavaScript 数组或其他东西中?
这是我的表格:
<form method="post" id="Submitter<? echo $count; ?>">
<input type="hidden" name="CartAdd" value="1">
<input type="hidden" name="Productcode" value="<? echo $row['Titel']; ?>">
<input type="hidden" name="Description" value="<? echo $row['Omschrijving']; ?>">
<input type="hidden" name="Tumbnail" value="<? echo $row['Afbeelding']; ?>">
<input type="SUBMIT" value="Order Now" class="order_button">