resp.getWriter().write("msg=1?id=" + l1);
Within the code snippet below, I am able to retrieve the responseText
. However, I am wondering how can I extract an attribute from the response text.
Sample AJAX Code:
function updatecategories(cu) {
var r1 = new XMLHttpRequest();
r1.onreadystatechange = function() {
if (r1.readyState == 4 && r1.status == 200) {
if (r1.responseText = "1") {
// How do I extract the 'id' from the response.
}
}
};
r1.open("GET", "../category_update?action=catu&cu=" + cu, true);
r1.send();
}