JQuery.ajax will not recognize JSON response from JSP -


i trying write simple application using jsp's, jquery, , ajax , display data on page.

here ajax function:

    $.ajax({                 type:"post",                 url:"interface_load_status_page.jsp",                 data:datastring,                 datatype:"json",                 success: function(data, textstatus, jqxhr){                     $("#response").html("");                     $("#response").append(data);                 },             }); 

that ajax call works long datatype set "text". unfortunately need work when set json. here code jsp called ajax function

<%         response.setcontenttype("application/json");         response.setcharacterencoding("utf-8");              string date = request.getparameter("date");             system.out.println("date: "+date);           if (date != null) {                 dbaccess acc = new dbaccess();                 arraylist<interfaceloadstatus> loadstatus = acc                         .loadstatusquery(date);                 //system.out.println(loadstatus);                 out.println(utils.getjsonloadstatus(loadstatus));             }         %> 

what jsp take results of query oracle database , convert json format so:

{"success":true,"interfaceloadstatus":[{"btype":"coc","start":"2013-04-22 03:30:10.0","end":"2013-04-22 04:35:38.0","exe":"01:05:28","handoff":"y"},{"btype":"dst","start":"2013-04-22 00:10:09.0","end":"2013-04-22 00:23:17.0","exe":"00:13:08","handoff":"y"},{"btype":"htl","start":"2013-04-22 00:10:10.0","end":"2013-04-22 01:17:14.0","exe":"01:07:04","handoff":"y"},{"btype":"rc","start":"2013-04-22 00:10:11.0","end":"2013-04-22 00:45:17.0","exe":"00:35:06","handoff":"y"},{"btype":"air","start":"2013-04-22 03:00:16.0","end":"2013-04-22 04:03:58.0","exe":"01:04:42","handoff":"y"},{"btype":"vp","start":"2013-04-22 03:00:16.0","end":"2013-04-22 04:03:58.0","exe":"01:04:42","handoff":"y"},{"btype":"air-iar","start":"2013-04-22 09:45:06.0","end":"2013-04-22 10:24:51.0","exe":"00:40:45","handoff":"y"}]} 

ok json output fixed still jquery ajax function not recognize it

each line valid json, according www.jsonlint.com. on other hand not entire output valid json if not feeding line line might reason.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -