From 4d55002e7acd845fdf2ed3d5577751e3dedf574d Mon Sep 17 00:00:00 2001 From: prashant Date: Thu, 29 Jan 2015 15:36:45 +0530 Subject: first commit added all the files --- js/test | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 js/test (limited to 'js/test') diff --git a/js/test b/js/test new file mode 100755 index 0000000..6cff80d --- /dev/null +++ b/js/test @@ -0,0 +1,36 @@ + $(document).ready(function(){ + + var basePath = Drupal.settings.basePath; + var modPath = basePath + "comments/"; +//function changeLikeDislike(type,id){ + +$("#likebt").click(function(){ +var type = $("#likebt").attr('data-name'); +var id = $("#likebt").attr('data-bid'); +console.log("###"); + var dataString = 'id='+ id + '&type=' + type; + $("#product_flash_"+id).show(); + $("#product_flash_"+id).fadeIn(400).html('<img src="' +modpath+'image/loading.gif" />'); + $.ajax({ + type: "POST", + url: modPath + "ajax/", + data: dataString, + cache: false, + success: function(result){ + if(result){ + var position=result.indexOf("||"); + var warningMessage=result.substring(0,position); + if(warningMessage=='success'){ + var successMessage=result.substring(position+2); + $("#product_flash_"+id).html(' '); + $("#product_"+type+"_"+id).html(successMessage); + }else{ + var errorMessage=result.substring(position+2); + $("#product_flash_"+id).html(errorMessage); + } + } + } + }); +}); +}); + -- cgit