Split a javascript string between two HTML tags

I have a javascript string which contains a HTML code to be loaded into my app. The issue I am finding is that the string has a bunch of tags in the head tags which just displays as text at the top of the content. How can I remove all the content of the string bar whats between the two body tags? E.g.

<html><head><meta>...</meta><style>...</style></head><body><div>...</div></body></html>

Needs changing to:

<div>...</div>

Thanks

You can use code below but you better change the service that returns html result.

var s = "<HTML><head><meta><head><body>YOUR HTML</body></html>"
var body = "<body>";
var bodyEnd = "</body>";
var res = s.substring(s.indexOf(body)+body.length,s.indexOf("</body>"));