Rev 13579 | Rev 13599 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function(){$('.scroll').jscroll({loadingHtml: '<center><img src="/img/ajax-loader.gif" alt="Loading" /></center>',autoTriggerUntil: 3,padding: 20,});$('.scroll').on('click','.viewproduct',function(e){var url = apihost+"clicks/add/"+me+"/"+$(this).data('id');$.ajax({url: url,// The name of the callback parameter, as specified by the YQL servicejsonp: "callback",// Tell jQuery we're expecting JSONPdataType: "jsonp",// Tell YQL what we want and that we want JSONdata: {format: "json"},// Work with the responsesuccess: function( response ) {if(response.success && response.type=='redirect'){document.location = response.url;}}});});$('.scroll').on('click','.likedeal',function(e){var that = $(this);if($(that).find('.btn',0).hasClass('active')){//User has already liked it,so remove likevar url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/like";}else{var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/like";}$.ajax({url: url,// The name of the callback parameter, as specified by the YQL servicejsonp: "callback",// Tell jQuery we're expecting JSONPdataType: "jsonp",// Tell YQL what we want and that we want JSONdata: {format: "json"},// Work with the responsesuccess: function( response ) {if(response.success){$(that).find('.btn',0).toggleClass('active');$(that).parent().find('li.dislikedeal',0).find('.btn',0).removeClass('active');}}});});$('.scroll').on('click','.dislikedeal',function(e){var that = $(this);if($(that).find('.btn',0).hasClass('active')){//User has already liked it,so remove likevar url = apihost+"/user_actions/rem/"+me+"/"+$(this).data('id')+"/dislike";}else{var url = apihost+"/user_actions/update/"+me+"/"+$(this).data('id')+"/dislike";}$.ajax({url: url,// The name of the callback parameter, as specified by the YQL servicejsonp: "callback",// Tell jQuery we're expecting JSONPdataType: "jsonp",// Tell YQL what we want and that we want JSONdata: {format: "json"},// Work with the responsesuccess: function( response ) {if(response.success){$(that).find('.btn',0).toggleClass('active');$(that).parent().find('li.likedeal',0).find('.btn',0).removeClass('active');}}});});});