I am trying to pass some HTML code from an ASP page back into a JQUERY function called
addlist but I can't get the syntax right with regards to writing out the html via ASP. if I
dont Include html in my response.write then my function
addlist works as it should. I am guessing this is in relation to ' or "
function addlist(param) { $.ajax({// sending an ajax request to addtocart.asp type: "POST", url: "/addtocart.asp?img="+param, //data: 'img='+param,// the product image as a parameter dataType: 'json', beforeSend: function(x){$('#ajax-loader').css('visibility','visible');},// showing the loading gif success: function(msg){
$('#ajax-loader').css('visibility','hidden'); //hiding the loading gif animation if(parseInt(msg.status)!=1) { //alert('status not equal to 1'); return false;// if there has been an error, return false } else
{ //alert('status equal to 1'); var check=false; var cnt = false;
for(var i=0; i<purchased.length;i++) { if(purchased[i].id==msg.id)// find if we have already bought this prduct { check=true; cnt=purchased[i].cnt; break; } }
if(!cnt)// if we haven't bought it yet, or we have removed it from the purchases, we insert it in the shopping cart $('#item-list').append(msg.txt);
if(!check)// if we haven't bought it yet, insert it in the purchased array { purchased.push({id:msg.id,cnt:1}); } else // else if we've bought it { if(cnt>=1) return false; // 1 products of type max