javascript - I get null when I pass JSON array with JQuery AJAX -


i facing problem jquery ajax function.

i trying send simple json through ajax asshown below.

$.ajax({             url: 'newfile.jsp',              type: 'get',             data: {"datasource":"hello1", definition:[{val1:"hello3"}]},             contenttype: 'application/json; charset=utf-8',             datatype: 'json',             async: false,             success: function(msg) {                 alert("successfully posted "+json.stringify(json));             }         }); 

the problem when

system.out.println(request.getparameter("datasource"));  system.out.println(request.getparameter("definition")); 

in newfile.jsp hello1 first , null second.

why null value in second println()?

thanks

in url variable inside ajax object, give full url of request. so:

$.ajax({             url: 'www.google.com/',              type: 'get',             data: {"datasource":"hello1", definition:[{val1:"hello3"}]},             contenttype: 'application/json; charset=utf-8',             datatype: 'json',             async: false,             success: function(msg) {                 alert("successfully posted "+json.stringify(json));             }         }); 

also, make sure there failure variable inside object literal, know happened, failed. helps debugging.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -