찜기능을 넣었다
사진 수정 전에 찜먼저 넣을줄은..음..
찜을 클릭하면 confirm 창이 뜬다
최종적으로 pick DB에 저장된다.
//찜 누를때
$("#heart").click(
function() {
if ($("#heart").is(":checked")) {
if (confirm('찜 할까요?') == true) {
$.ajax({
url : "InsertPickServlert",
type : "get",
dataType : "text",
data : {
flag : '1',
productName : '${product.productName }'
},
success : function() {
$(".heart").attr('style',
'text-shadow: 0 0 0 #DC143C');
}
});
} else {
return false;
}
} else if (!$("#heart").is(":checked")) {
if (confirm('찜 에서 뺄까요?') == true) {
$.ajax({
url : "InsertPickServlert",
type : "get",
dataType : "text",
data : {
flag : '2',
productName : '${product.productName }'
},
success : function() {
$(".heart").attr('style',
'text-shadow: 0 0 0 #f0f0f0');
}
});
} else {
return false;
}
}
});
찜이면 찜 표시 해줌.
if (nickname != "null") {
//회원일경우만 찜확인
$.ajax({
url : "InsertPickServlert",
type : "get",
dataType : "text",
data : {
flag : '3',
productName : '${product.productName }'
},
success : function(data) {
if (data != 0) {
$("#heart").attr('checked', true);
$(".heart").attr('style',
'text-shadow: 0 0 0 #DC143C');
}
}
});
}