دنبال کننده ها

۱۳۹۶ اسفند ۹, چهارشنبه

javascript - JSONObject toString return [object object]

[ad_1]



My code in java like this:



PrintWriter out = response.getWriter();
response.setContentType("application/json");

JSONArray jsonArray = new JSONArray();
......
System.out.println(jsonArray.toString());

out.write(jsonArray.toString());


And the string system print out is:



["value":"logan","data":"category":"Paper","id":"tt01",
"value":"logan uniform","data":"category":"Paper","id":"tt04",
"value":"logan unhappy","data":"category":"Paper","id":"tt05"]


And my code in javascript is:



jQuery.ajax(
"method": "GET",
"url": paperurl,
"success": function(data)
alert(data);

)


And it alerts [object Object],[object Object],[object Object]



What causes this error and how can I work around it?




[ad_2]

لینک منبع