Ich habe diesen Code, wo ich den Wert der "totalcompra" ID auf eine andere Seite übergeben muss. page1.htmlWerte zwischen zwei html übergeben
<div id="total">
<div class="container-total">
<div class="text-total">
<p>Total:$</p><p id="totalcompra" name="totalcompra"></p>
</div>
<div class="ahr">
<input type="submit" id="compra_segura" class="submit btn btn-success action-button" value="Compra Segura"/>
</div>
</div>
</div>
Und ich möchte hier den Wert setzen.
page2.html
<aside>
<div id="side-container">
<h2 class="quoter-text">Resumen de compra</h2>
<div class="rsm"></div>
<div class="pymt-total"><p class="total-pym">Total:</p></div>
</div>
</aside>
ajax
$('#compra_segura').click(function() {
$.ajax({
type: 'POST',
url: '/payment/',
data: { total : $('#totalcompra').text() },
success: function(data)
{
$('.total-pym').html(data);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
});
ich es mit AJAX und jQuery habe versucht zu tun, aber ich habe nicht erfolgreich gewesen. Wie kann ich es tun? Vielen Dank.
teilen Sie Ihre Ajax/Jquery cod e. – tech2017
Sie müssen lesen über [.load()] (http://api.jquery.com/load/) und [Beispiele] (http://www.jquery-tutorial.net/ajax/the-load-method /) –
Machen Sie auch die Schaltfläche ein 'type =" button "' – mplungjan