Skip to content

Instantly share code, notes, and snippets.

@anakaine
Created September 4, 2019 04:38
Show Gist options
  • Save anakaine/1f45ee78ecbdda831a11e94e15fe9b25 to your computer and use it in GitHub Desktop.
Save anakaine/1f45ee78ecbdda831a11e94e15fe9b25 to your computer and use it in GitHub Desktop.
jQuery(document).on('click', '.gv-button-delete', function (e) {
e.preventDefault(); //prevent submission
console.log('Intercepted delete button request');
var delLoc = "";
(function ($) {
var delLoc2 = $('.gv-button-delete').attr("href"); //capture default action, because we need the time-valid nonce
delLoc = delLoc2;
}(jQuery));
var objID = document.getElementById("input_4_40").value;
objID = parseInt(objID);
var iframe = document.getElementById("MapFrame1");
var result = "";
flag = 0;
if (iframe) {
var iframeContent = (iframe.contentWindow || iframe.contentDocument);
var result = iframeContent.WriteLog(objID); //call the fucntion from the iframe, and hopefully wait for a result.
console.log(result);
flag = 1;
}
while (flag == 1){
if (result == "error") {
console.log("Step 5")
console.log("There was an error with removing the feature");
if (flag == 1) {
break;
}
} else if (result == "ok") {
console.log("Step 5")
console.log("The spatial delete completed correctly");
if (flag == 1) {
break;
}
} else {
console.log("Step 5")
console.log("unexpected result of spatial delete")
if (flag == 1) {
break;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment