0
對於編程我很新穎,我已經使下面的代碼顯示了li 元素中的鏈接,如果滿足php條件的話。一切都工作正常,但問題是,像li這樣的html元素不會在滿足php條件時刷新並需要刷新頁面。我知道這是因爲服務器和客戶端語言。 有人可以幫助我解決這個問題的ajax代碼建議。當滿足php條件時刷新ul或div元素
大大appriciated,THX
<!-- checks if product in cart and if yes shows checkout and cart button -->
<ul class="main_menu">
<?php if ($this->cart->hasProducts()) { ?>
<li><a id="top-checkout" href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></li>
<li><a id="top-cart" href="<?php echo $cart; ?>"><?php echo $text_cart; ?></a></li>
<?php } else { ?>
<!-- checks if voucher in cart and if yes shows checkout and cart button -->
<?php if ($this->cart->hasProducts() || (isset($this->session->data['vouchers']) && $this->session->data['vouchers'])) { ?>
<li><a id="top-checkout" href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></li>
<li><a id="top-cart" href="<?php echo $cart; ?>"><?php echo $text_cart; ?></a></li>
<?php } ?>
<?php } ?>
<!-- END -->
<!-- checks if customer is logged in and if yes shows account button -->
<?php if ($logged) { ?>
<li><a id="top-account" href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li>
<?php } ?>
<!-- END -->