javascript - why browser is adding extra backward slashes to the json Response and also JSON array length is wrong? -



javascript - why browser is adding extra backward slashes to the json Response and also JSON array length is wrong? -

this way making callback request server json value

$(document).on('click', '.currentorderrow', function(event ) { var orderid = $(this).attr("id_data"); $.ajax({ type: 'get', url: url+'/oms/oms1/getorderdetails?orderid='+orderid, jsonpcallback: 'jsoncallback', cache: true, datatype: 'jsonp', jsonp: false, success: function (response) { alert(response.json_value.length); console.log('response is'+json.stringify(response)); }, error: function (e) { alert('into error '); } }); });

i observing while json response shown in server console having slashes within in ()

{ "json_value": "[{\"contact_phone_no\":\"9876543210\",\"surcharges\":\"50\",\"vendorname\":\"vc4 raj\",\"contact_email\":\"rajk@gmail.com\",\"count\":\"0\",\"discount_div\":\"10%\",\"itemid\":\"188\",\"strikeprice_cutoff\":\"90\",\"name\":\"popcorn plain salted\",\"contact_address\":\"kukatpally, hyderabad\",\"quantity\":\"1\",\"email_id\":\"raj@hmail.com\",\"date_time\":\"14:10:37\",\"toppings\":[{\"name\":\"quantity 1\",\"value\":[\"honey chocolate sauce 10 ml\",\"none\",\"none\",\"none\",\"none\",\"none\",\"none\",\"none\"]}],\"screen\":\"scr-3\",\"seat_num\":\"d12\",\"customer_name\":\"ganesh\",\"image\":\"images/icon-print.png\",\"contact_person\":\"kiran\",\"item_description\":\"item description\",\"vendor_id\":\"9\",\"crusts\":[],\"vat\":\"70\",\"customer_mobil\":\"9090987878\",\"price\":\"115\",\"mobile_number\":\"1234567898\",\"servicescharges\":\"50\",\"orderid\":\"14101337\"},{\"contact_phone_no\":\"9876543210\",\"surcharges\":\"50\",\"vendorname\":\"vc4 raj\",\"contact_email\":\"rajk@gmail.com\",\"count\":\"0\",\"discount_div\":\"10rs\",\"itemid\":\"194\",\"strikeprice_cutoff\":\"110\",\"name\":\"popcorn regular 300 ml fountain apple\",\"contact_address\":\"kukatpally, hyderabad\",\"quantity\":\"1\",\"email_id\":\"raj@hmail.com\",\"date_time\":\"14:10:37\",\"toppings\":[{\"name\":\"quantity 1\",\"value\":[\"chocolate\",\"vanila\"]}],\"screen\":\"scr-3\",\"seat_num\":\"d12\",\"customer_name\":\"ganesh\",\"image\":\"images/icon-print.png\",\"contact_person\":\"kiran\",\"item_description\":\"item description\",\"vendor_id\":\"9\",\"crusts\":[{\"name\":\"quantity 1\",\"value\":[\"butter scotch\"]}],\"vat\":\"70\",\"customer_mobil\":\"9090987878\",\"price\":\"275\",\"mobile_number\":\"1234567898\",\"servicescharges\":\"50\",\"orderid\":\"14101337\"}]" }

and why length beingness shown 1525 ??

because above json consisting of 2 values within ?? (starting contact_phone_no each new record )

there bug on server side. instead of sending json object graph (i.e. nested json objects), sends single string contains objects in json format. or set way: send json within of json.

to parse data, need code:

var info = json.parse(response.json_value);

or prepare bug on server side.

javascript jquery

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -