Hello! I have a nose to poke my nose why the hide () function does not work for me. thank.

function addToCart(itemId){ console.log("js - addToCart"); $.ajax({ type: 'POST', async: false, url: "/cart/addtocart/" + itemId + '/', dataType: 'json', succes: function (data){ if (data['success']){ $("#cartCntItems").html(data['cntItem']); $("#addCart_"+itemId).hide(); $("#removeCart_"+itemId).show(); } } }); } 
  • It looks ok. Check if there is an element "#addCart_"+itemId - lampa
  • @lampa this item is "#addCart _" + itemId, its id values ​​= "addCart_7" why it doesn’t work I don’t understand the library connected the norms <script src = " code.jquery.com/jquery-latest.js "></script> < script type = "text / javascript" src = "/ js / main.js"> </ script> may still have ideas? - Vitaliisss
  • And in this if (data ['success']]) {does it go in? - zhenyab pm
  • @Vitaliisss it is possible that there are other errors in the cola due to which this code does not work. It is also possible that the answer does not come in json format. What does the browser debugger say? Insert console.log in the data['success'] condition - lampa
  • one
    Sorry for the stupidity in the "succes" missed s. Sorry. - Vitaliisss

0