Any reason to use .attr('data-cid') instead of .data('cid')?  .data converts to int automatically if the variable looks like an int.