I have an form being submitted via AJAX. The response from the server in an entire web page (HTML). I would like to alert only the content within a span tag with the id “message” which exists on that response page. I don’t want to alert the entire page. How to do this?
$.ajax({
url: '/accounts/login/',
data: $(this).serialize(),
success: function(output) {
alert(output)
}
});
My code alerts the whole page.
Try this: