This does not answer the question - jQuery Ajax return html AND json data
I can not use the wrap method because I do not have a single html string. I am not using Phery, I have tried the first option here and the second nested call runs before the first so that data is undefined- jquery Use two done callbacks in same function, one with datatype json one without and we are not using html5 only for this. Therefore the referenced answer does not address the question.
In my .done function I have (data) returning. This data is a mixture of php echo's and a single JSON_encode array. Sample data:
.....
//other divs and data above this point
<div id="test">text</div>
{"ids":["1","5","2","6"]}0
AJAX
.done(function(data) {
console.log(data);
func2(json_string)
})
I want to be able to extract and separately work with the array {"ids":["1","5","2","6"]}0. I am trying to pass it along to another function, but only that portion of the data
Acceptrequest header to decide whether to respond with HTML or JSON (but not both)