I am trying to get the responseTxt, statusTxt, jqXHR output but it is not working in the iframe instead it only working in the load function. I have seen the related threads but it was not helpful.
I am trying after load iframe it will show an alert as LOADED as in my code but it not working.
Could you please help me to create this function how I get responseTxt, statusTxt, jqXHR response while iframe src change?
$(document).ready(function() {
$(document).on("click", "li> a[target='iframeload']", function(e) {
e.preventDefault();
var designation = $(this).attr("href");
if (!window.navigator.onLine) {
alert("Net Lost");
return false;
} else {
$("iframe#iframeID").attr("src", designation, function(responseTxt, statusTxt, jqXHR) {
if (statusTxt == "success") {
alert("LOADED");
} else {
if (statusTxt == "error") {
alert("Error : " + jqXHR.status + " " + jqXHR.statusText);
return false;
}
}
});
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>