Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/10/2013, 14:43
enmaska
 
Fecha de Ingreso: octubre-2011
Ubicación: Zahara, Sevilla, Granada...
Mensajes: 12
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: Botón añadir a favoritos (No los del navegador)

Muchas gracias. Al final lo solucioné de otra forma, actualicé la librería jquery, estaba gastando la 1.4 y además cambié

$('.love_input').click(function(e) {

por esto otro

$(document).on('click', '.love_eliminar', function(e) {


Logrando así hacer su cometido, se que no está muy pulido, pero cumple su cometido. Si alguien se anima a mejorarlo.

Os dejo el código:


Código:
    $(document).on('click', '.love_input', function(e) {
	    e.preventDefault()
        var id = $(this).attr("rel");
        var action = $(this).attr("data-action");
        
        
        $(this).text("Quitar de favoritos!");
        $(this).removeClass( "love_input");
        $(this).addClass( "love_eliminar");
        
	        $.ajax({
	            type: "GET",
	            url: "/ajax/love-ventas.php",
	            data : {
				      id : id,
				      action : action
				  },
	            
	            success: function(datos){
		           	$(function() {
		    		
			    	});
		            return false;
	            }
	        });
	        console.log("GUARDADO!! --> " +id );
        });



//borrar love
    $(document).on('click', '.love_eliminar', function(e) {
        e.preventDefault()
        var id = $(this).attr("rel");
        $(this).text("Añadir a favoritos!");
        $(this).removeClass( "love_eliminar");
        $(this).addClass( "love_input");
        
	        $.ajax({
		            type: "GET",
		            url: "/ajax/love-ventas-clean.php",
		            data: "id="+id,
		            success: function(datos){
			           	$(function() {
			    		
				    	});
			            return false;
		            }
		        });
		        console.log("ELIMINADO!! --> " +id );
        });