jQuery unexpected token error
I am getting this error: Uncaught SyntaxError: Unexpected Token
This is my code:
$(document).ready(function(){
$(".cartsummary .showcartsumm").click(function() {
$(".cartsummary .cartitems").show();
});
$(".cartsummary").hoverIntent(
function () {
$(".cartsummary .cartitems").fadeIn();
},
function () {
$(".cartsummary .cartitems").fadeOut();
})
nutrishowcart(0);
});
function nutrishowcart(slidedown)
{
$.ajax({
type: "POST",
url: "/CUSTminicart.aspx" + "/" + "Render",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "text",
success: function(msg) {
// msg2 = eval(msg);
// Get rid of the copyright text that kills JSON
index = msg.indexOf('<div align="center">');
msg2 = msg.slice(0,index);
//msg2 = msg;
json = eval("(" + msg2 + ")");
$("#cartwrapper").html(json.d);
if (slidedown==1) {
$(".cartsummary
.cartitems").fadeIn().delay(2000).fadeOut();
}
},
error:function (xhr, ajaxOptions, thrownError){
alert("Minicart issue");
}
});
}
This is on the last line in jquery.min.js
The error seems to be with json = eval("(" + msg2 + ")");
Any ideas how to resolve this?
No comments:
Post a Comment