Skip to content

Instantly share code, notes, and snippets.

@anakaine
Created September 4, 2019 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anakaine/e0b00aae0269e1d7e41921bcf85cd197 to your computer and use it in GitHub Desktop.
Save anakaine/e0b00aae0269e1d7e41921bcf85cd197 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");
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.
var result = await f();
console.log(result);
if (result == "error") {
console.log("Step 5")
console.log("There was an error with removing the feature");
} else if (result == "ok") {
console.log("Step 5")
console.log("The spatial delete completed correctly");
} else {
console.log("Step 5")
console.log("unexpected result of spatial delete")
}
}
});
async function f() {
var result = iframeContent.WriteLog(objID); //call the fucntion from the iframe, and hopefully wait for a result.
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment