JSON formatting (Sending JSON via jQuery AJAX post to Java/Wicket server) JSON formatting (Sending JSON via jQuery AJAX post to Java/Wicket server) ajax ajax

JSON formatting (Sending JSON via jQuery AJAX post to Java/Wicket server)


You have to use JSON.stringify:

$.ajax({    type: 'post',    data: JSON.stringify(lookup),    contentType: 'application/json',    dataType: 'json'});

You should also specify 'application/json' as the contentType. By default jQuery will serialize objects with application/x-www-form-urlencoded (even if the contentType is application/json'). So you have to do it manually.

EDIT: Key for 'post' should be type, not method.