function addItem(){ var action = $("#action").val(); var itemId = $("#itemId").val(); var cantidad = $("#cantidad").val(); $.ajax({ url: action, type: "POST", data: {itemid: itemId, cantidad: cantidad}, //data: dataString, dataType: "JSON", success: function(datos){ if( datos.success == 1){ $('#modalCenter').modal('show'); }if(datos.success == 0){ if(datos.agotado == 1){ $('#modalAgotado').modal('show'); } } }, error : function(xhr, status) { alert('Por favor vuelve a intentarlo. Si el problema persiste revisa tu conexion a internet.'); }, }); } function closeAgregar(){ $('#modalAgotado').modal('hide'); } function addItemRel(id){ var action = $("#action").val(); var itemId = id; var cantidad = $("#cantidad").val(); $.ajax({ url: action, type: "POST", data: {itemid: itemId, cantidad: cantidad}, //data: dataString, dataType: "JSON", success: function(datos){ if( datos.success == 1){ $('#rel_nombre').text($('').val()); $('#rel_tamano').text($('').val()); $('#rel_img').html(''); $('#modalCenterRel').modal('show'); $('#rel_nombre').text($('#nombre_'+id).val()); $('#rel_tamano').text($('#tamano_'+id).val()); $('#rel_img').prepend(''); }if(datos.success == 0){ if(datos.agotado == 1){ $('#modalAgotado').modal('show'); } } }, error : function(xhr, status) { alert('Por favor vuelve a intentarlo. Si el problema persiste revisa tu conexion a internet.'); }, }); } function closeAgregar(){ $('#modalAgotado').modal('hide'); }