Note: The answer provided by Juan Mendes has been selected as the best answer for my situation due to its usefulness. AxGryndr also offered valuable information, so I recommend reading both answers as they are beneficial in different scenarios. Thank you to both contributors for assisting with this issue.
I previously posted a similar question on this platform, which helped solve the initial part of my problem. However, I am now facing another challenge. I am trying to make Ctrl + N trigger a script containing AJAX, but when I run the .get function, it triggers the default action instead. Does anyone know of a workaround for this issue?
The following code snippet demonstrates the problem I am encountering:
function checkkey(e)
{
if(e.ctrlKey && e.keyCode == 'N'.charCodeAt(0) && !e.shiftKey && !e.altKey)
{
try{e.preventDefault();}catch(ex){}
var m_objXMLHttpReqObj = new XMLHttpRequest();
m_objXMLHttpReqObj.open("GET", "", false);
m_objXMLHttpReqObj.send();
}
}
For a visual representation of my issue, you can view this JSFIDDLE.