G.D G.D - 1 month ago 5x
Ajax Question

Ajax parameters are encrypted when passed to Java contoller

I have below object named itemInfo in Javascript-

itemInfo = {



I am passing this object through ajax to a java controller-

type: 'GET',
url: '/bin/path/servlet',
dataType: 'text',
data: {
productId: itemInfo.catalogId,
operation: "addToCart"
success: function(obj) {
if (obj) {
//do something
error: function(request, status, error) {


When I see the request, its sent like this-


Decoded URL parameters looks like this-


Its not making any sense in Java and passed values are not readable. Is something wrong with implementation? How can I retrieve passed values in Java controller?


Try to stringify your data:

productId: JSON.stringify(itemInfo.catalogId)

By the way i don't think is a good idea to post complex object by "GET" method. I suggest to change your servlet to accept method "POST" then modify your script type to "POST".