I need to show my error message in red when the div.load errors out as shown in the code. If it is success, I would render the content as it is, How can I do this?
$('#TermsAndConditions').load(termsconditionsurl, null, function (response, status, xhr) {
if (status == "error") {
var msg = "Sorry there was an error: ";
$(this).addClass("error");
$("#TermsAndConditions").html(msg + xhr.status + " " + xhr.statusText);
}
});
Thanks,
Adarsh
Assuming the div has ID “TermsAndConditions” as per your selector, you would do this:
And in css have:
EDIT:
You should put this in the document ready function: