summaryrefslogtreecommitdiff
path: root/js/test
diff options
context:
space:
mode:
Diffstat (limited to 'js/test')
-rwxr-xr-xjs/test36
1 files changed, 36 insertions, 0 deletions
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('&nbsp;');
+ $("#product_"+type+"_"+id).html(successMessage);
+ }else{
+ var errorMessage=result.substring(position+2);
+ $("#product_flash_"+id).html(errorMessage);
+ }
+ }
+ }
+ });
+});
+});
+