dimanche 25 octobre 2020

How to set get and compare the Value of li attributes with another li attribute with Jquery?

<li class="js-option js-radio" data-price = 200 data-model="product-02">

So my Plan is to decide if data-model is product 01 or 02 and if its 01 set data-price to a specific value and if it is 02 to another. The Data for ethe price is coming from an external api.

$.ajax({
    url: 'xx',
    beforeSend: function(xhr) {
         xhr.setRequestHeader("apikey", "")
    }, success: function(data){
       
        
        $("#response").val(data.name);
        $("#myVar").val(data.price);



Aucun commentaire:

Enregistrer un commentaire