blob: 6cff80d28e0a3e7ef1a40d5b25b6ebdff21d2e54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
}
}
}
});
});
});
|