I try to make shopping cart with case below:
I have button onclick=addItem(action,cat_no) Will fire this function when click:
function addItem(action,cat_no) {
switch(action) {
case "adds":
queryString = 'action='+action+'&cat_no='+cat_no;
execute ajax adds...}
break;
case "drop":
queryString = 'action='+action+'&cat_no='+cat_no;
execute ajax drop...}
This function pass the value to php script.
I found that if I have the item with cat_no having '+' and '&' will fail.
For Example let say: cat_no = 'SS+03L',
I believe it is because when it puts this value into the queryString, the '+' became the operator instead of value:
queryString = 'action='adds'&cat_no='SS+03L;
(When I check echo $_GET['cat_no'] I only get 'SS' instead of 'SS+03L')
In this case, what can I do to make sure the 'SS+03L' can be put correctly into the query and pass to the php?