jquery - On Django, cookie is assigned outside the boundary of string -
i tried use both document.cookie
, $.cookie("productid",productid)
on javascript/jquery, seems assignment goes out of boundaries.
when run document.cookie command in chrome, expecting get:
"csrftoken=bh1n0k3sbkjxqtclaowwt5dpgn22dxqh; productid=2;"
but instead, get:
"csrftoken=bh1n0k3sbkjxqtclaowwt5dpgn22dxqh; productid=; 2"
i'm not sure if it's because of csrftoken has been assigned. problem is, happening, , how assign productid properly?
i did not put in imported js file, instead, assigned on html onclick attribute as:
onclick='document.cookie="productid={{ product.id }}"';
Comments
Post a Comment