javascript - jQuery unexpected token error -


i getting error: uncaught syntaxerror: unexpected token

this 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);                 // rid of copyright text 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 on last line in jquery.min.js

the error seems json = eval("(" + msg2 + ")");

any ideas how resolve this?

this isn't valid json. should json = eval("{" + msg2 + "}"); json object.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -