Subversion Repositories SmartDukaan

Rev

Rev 13672 | Rev 13686 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13672 Rev 13682
Line 24... Line 24...
24
			}
24
			}
25
		});
25
		});
26
	});
26
	});
27
	$('.row').on('click','.likedeal',function(e){		
27
	$('.row').on('click','.likedeal',function(e){		
28
		var that = $(this);
28
		var that = $(this);
29
		if($(that).find('.btn',0).hasClass('active')){
29
		if($(that).hasClass('active')){
30
			//User has already liked it,so remove like
30
			//User has already liked it,so remove like
31
			var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/like";	
31
			var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/like";	
32
		}else{
32
		}else{
33
			var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/like";
33
			var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/like";
34
		}
34
		}
Line 49... Line 49...
49
					$(that).parent().find('li.dislikedeal',0).removeClass('active');
49
					$(that).parent().find('li.dislikedeal',0).removeClass('active');
50
				}
50
				}
51
			}
51
			}
52
		});
52
		});
53
	});
53
	});
-
 
54
	$('.row').on('click','#unlikebtn',function(e){
-
 
55
		e.preventDefault();
-
 
56
		var url = $('#unlikeproductform').attr('action')+'?'+$('#unlikeproductform').serialize()
-
 
57
		console.log(url);
-
 
58
		$.ajax({
-
 
59
			url: url,
-
 
60
			// The name of the callback parameter, as specified by the YQL service
-
 
61
			jsonp: "callback",
-
 
62
			// Tell jQuery we're expecting JSONP
-
 
63
			dataType: "jsonp",
-
 
64
			// Tell YQL what we want and that we want JSON
-
 
65
			data: {
-
 
66
				format: "json"
-
 
67
			},
-
 
68
			// Work with the response
-
 
69
			success: function( response ) {
-
 
70
				// console.log(response);						
-
 
71
			}
-
 
72
		});
-
 
73
		$('#myModal').modal('hide');
-
 
74
	})
54
	$('.row').on('click','.dislikedeal',function(e){		
75
	$('.row').on('click','.dislikedeal',function(e){			
55
		var that = $(this);
76
		var that = $(this);
56
		if($(that).find('.btn',0).hasClass('active')){
77
		if($(that).hasClass('active')){
57
			//User has already liked it,so remove like
78
			//User has already liked it,so remove like
58
			var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/dislike";	
79
			var url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/dislike";	
59
		}else{
80
		}else{
-
 
81
			console.log('show modal');
-
 
82
			$('#myModal').find('#productToHide',0).val($(this).data('id'));
-
 
83
			$('#myModal').modal();
60
			var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/dislike";
84
			var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/dislike";
61
		}
85
		}
62
		$.ajax({
86
		$.ajax({
63
			url: url,
87
			url: url,
64
			// The name of the callback parameter, as specified by the YQL service
88
			// The name of the callback parameter, as specified by the YQL service