While Press "Esc" key ajax request and response is stopped in the browser
-
Hi, While running my application if any error gets then, a modalbox will show with the error message, So I close the modalbox using "Esc" key. In the meantime the next ajax request and response is stopped in the browser since i pressed "Esc" key. So I want to close modalbox using "Esc" and also the next ajax request and response do not stopped by the browser?. Can anybody help me how can i handle this? Regards, Periyasamy.R
-
Hi, While running my application if any error gets then, a modalbox will show with the error message, So I close the modalbox using "Esc" key. In the meantime the next ajax request and response is stopped in the browser since i pressed "Esc" key. So I want to close modalbox using "Esc" and also the next ajax request and response do not stopped by the browser?. Can anybody help me how can i handle this? Regards, Periyasamy.R
Most browsers use the Escape key to cancel out of loading a page and I think it is probably also causing any other AJAX requests being processed to also be canceled by your browser. As for stopping this default behavior, you could try preventing the Esc key's default action with the following:
//place in the window keydown event
//IE
e.cancelBubble=true;
e.returnValue = false;//FF
if (e.stopPropagation){
e.stopPropagation();
e.preventDefault(); -
Most browsers use the Escape key to cancel out of loading a page and I think it is probably also causing any other AJAX requests being processed to also be canceled by your browser. As for stopping this default behavior, you could try preventing the Esc key's default action with the following:
//place in the window keydown event
//IE
e.cancelBubble=true;
e.returnValue = false;//FF
if (e.stopPropagation){
e.stopPropagation();
e.preventDefault();Hi, Thanks for your reply. Great!. It works for me.Now the ajax request and response is not stopped when i use "Esc" or any key. Its good. Thanks, Regards, Periyasamy.R
modified on Thursday, October 28, 2010 2:22 AM
-
Hi, Thanks for your reply. Great!. It works for me.Now the ajax request and response is not stopped when i use "Esc" or any key. Its good. Thanks, Regards, Periyasamy.R
modified on Thursday, October 28, 2010 2:22 AM
-
Are you talking about a regular javascript modal message box or a html/css/js modalbox? If it's the latter, I would call it's close function prior to stopping the event propagation in your keydown handler.
Hi Jules, It works for me. Thanks for your reply. -Periyasamy.R