PHP how to disable HREF once it is clicked using Jquery or JavaScript? -


my problem how disable href once clicked? please me badly need finish program in php

style.css

.disabled { pointer-events: none; 

}

  1. i assume want send cart php
  2. i assume not want page change
$(function() {   $(".cart").on("click",function(e) {     e.preventdefault(); // never follow link     var $thislink = $(this);     if ($(this).not(".added")) {       $.post(this.href,function(data) { // return { "successfullyadded":"true" } php         if (data.successfullyadded=="true") {           $thislink.addclass("added");            $thislink.text("added");          }       });     });   }); }); 

using

<a class="cart" href="?add=<?php echo($i); ?>">add cart</a> 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -