This is what i'm trying to do and its pretty simple but i'm getting stuck: I'm trying to send a JSON object formed in JSP to a server side servlet and parse it .
What i've done till now:
- Constructed the json.
- sending the json to the backend
$.ajax({ data: jsontosend, url: 'MYSERVLET?name=asdf', success: function(res){ alert('posted'); } })
Problem:
- What name is this JSON refrenced by so i can get it in the servlet using the request.getParameter() ?
- When i print request.getParameterNames() , i get the parameter name as the JSON string itself so the output of all parameter names inside the MYSERVLET looks like this
Parameter = name Parameter = {"ticker":"asd","date":"asd","bucket":"300","entry":[{"type":"asd","indicator":"asd","condition":"asd"}],"exit":[{"type":"qwe","indicator":"qwe","condition":"qwe"}]}
Anyone have an idea as to what the problem is ?
Also i tried looking at this question here on stackoverflow but the same problem exists there too. Also there is a duplicate question which hasn't been answered .
Help! :(