javascript - Get JSON object from AJAX call -


i'm new ajax , javascript. in project, have json object in javascript file. i've used spray-json , shows me json object in url. http://localhost:8081/all-modules

{   "status": "s1000",   "description": "success",   "results": ["module1", "module2", "module3"] } 

my ajax call

  $.ajax({         url: 'http://localhost:8081/all-modules',         datatype: 'application/json',         complete: function(data){             alert(data)         },         success: function(data){             alert(data)         } 

it returns alert [object object]. issue in here?

try following;

var data = '{"name": "john","age": 30}';  var json = json.parse(data);  alert(json["name"]); alert(json.name); 

you can check out link: how access json object in javascript


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -