I have a variable () loaded with a html code:
$.get(url, function (res, data) {
response = res.responseText;
}
The response variable gets loaded with this:
<html>
<head>
</head>
<body>
<div id="version">1</div>
</body>
</html>
how can I retrieve the content of the div#version to a variable version?
Thanks
If you want jQuery to parse your result resulting HTML and just retrieve the content of
#versionyou can use the following:Edit: Refer to @freakish, whose is the better answer.