I want to call other script to start running every 1 second after the first one is called,
but am having a problem the above script doesn’t report any error in browser and its not working. it only do post call to first function.
but doesn’t call other one after is called
I want the first call to do post after then call other one to also do a post call, run every 1 second or call file2 every 1 second
and then when it reaches 5min do not do any post call on file2(stop calling)
<script>
function Fun_1() {
("#MkB").click(function (event) {
Execute();
});
function Execute() {
.ajax({
type: "POST",
url: "file",
data: {
textnum: ("input[name='textnum']").val(),
},
beforeSend: function () {
if (("form input[name='textnum']").val() == "") {
("#error").text("action needed.");
return false;
}
},
complete: function () {
("#error").hide();
},
success: function (response) {
myVa = setTimeout(() => {
clearTimeout(myVar);
}, 300000);
setTimeout(Fun_2, 3000);
},
error: function () {
alert("Something has Happened");
},
});
}
}
function Fun_2() {
myVar = setTimeout(Fun_2, 1000);
timeout: 300000,
.ajax({
type: "POST",
url: "file2",
success: function (res) {
var Rmsg = res.msgEnd;
("#FeMsg_1").html(res.msg);
if (Rmsg == 'Complete') {
clearTimeout(myVar);
clearTimeout(myVa);
},
});
}
(document).ready(function () {
Fun_1();
});
</script>