jquery - Parse nested json into ajax -


i have sample json structured as,

{ key : { "data1":data1, "data2":data2 }} 

i want parsed 'data',

$.ajax({     type: 'post',     url: 'url',     data: <--- here ,     success: function() {          *****     } }); 

how do it?

try use json.stringify

var data= { "key" : {"data1":"data1", "data2":"data2" }}; new request.json({     url: '/echo/json/',     type: "post",     data: json.stringify(data),     contenttype: "application/json",     onsuccess: function(res) {         document.write(data.key.data1);         console.log(data.key.data1);     } }).send(); 

here working jsfiddle: http://jsfiddle.net/dk5dl/87/


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -