次の問題があります。
ユーザーが購入したい映画の数を増やしたい場合、私が最初に行うことは、jQuery.ajax によって映画の ID を送信することです。これは、更新する PHP 関数になり、同じ関数で SELECT を実行して取得します価格の現在の合計は、変数 totalpricemovie の値を返します。その値を、表の TOTAL と書かれた最後の列に配置したいのですが、どのようにではありません: S
これは私の窓です
ID ムービーを Update に送信し、列 total TOTAL($) で更新の合計価格を取得する jQuery コード
$('.quantitymovie').live('change',function() {
claveMovie = $(this).attr('id');
updateQuantityMovie = {
idmovie : claveMovie,
tag : 'updateQuantity'
};
$.ajax({
type: "POST",
url: "./php/processFunctions.php",
data: updateQuantityMovie,
success: function(response) {
if(success.response == 'success') {
//put update price of a movie in last td of column called Total($)
} else {
alert ("Error al actualizar la cantidad de películas");
}
}
});
return false;
});
行のインデックスを取得し、変数 totalpricemovie を含む最後のセルをそこに配置する必要があると思います。
HTMLコード表
<div id="checkOutModal">
<fielset>
<legend>Datos de compra</legend>
<form id="formCheckout" name="checkOut" method="POST" action="php/processFunctions.php">
<table id="orderCheckout">
<th scope="col">Películas</th>
<th scope="col">Precio ($)</th>
<th scope="col">Cantidad</th>
<th scope="col">Total ($)</th>
</table>
<p>
<label for="nombreCliente">Nombre completo</label>
<input id="nombreCliente" class="required onlyLetter" name="nombreCliente" type="text"/>
</p>
<p>
<label for="direccionCliente">Dirección</label>
<input id="direccionCliente" class="required" name="direccionCliente" type="text"/>
</p>
<p>
<label for="emailCliente">Correo electrónico</label>
<input id="emailCliente" class="required" name="emailCliente" type="text"/>
</p>
<input id="finalizarCompra" name="finalizarCompra" type="submit" value="Finalizar"/>
<a href="#" id="contShopping">Seguir Comprando</a>
</form>
</fieldset>
</div>
注:テーブルの内容は jquery.ajax() の別の関数で生成されます