When you encounter a situation where you can't debug JavaScript code when submitting to a subpage, here's a good workaround, and hopefully it will help.
In a recent project, you will not be able to debug JavaScript code when submitting to a child page, sometimes this problem, we can not normal in the browser, see our child page JavaScript code, so can only use the original alert or Console.log (), of course, this is a solution, but sometimes, we want to see how the program is actually running, but also can see what each parameter is exactly what value, so the meaning is relatively large. I put a picture on it and you'll probably know when it's going to happen. Code as follows: <script> function Stopwatchdog (watchdogid) { alert ("AA"); var url = ' <s: URL value= "/watchdog/stopwatchdog"/> '; var params = { watchdogid:watchdogid, }; $.post (URL, params, function (data) { if (data.success) { closedialog (); tbgrid.send (); } else { if (data . errormsg!= null && data.errormsg!= "") { Jalert (data.errormsg, System message); } else { Jalert ("Stop exception ", System Message"); } $ ("#saveBtn"). Removeattr ("Disabled"); $ ("#saveBtn"). CSS ("Color", "white"); } }, "JSON"); } </script> This is actually a function declaration, and if you know the JavaScript context, You know, actually. The function declaration is only the name of the function loaded when the page context is loaded, and its function contents are not loaded properly. If we replace it with a function or define the function declaration in function autonomy, then we can solve the problem. Code as follows: (function () { function Stopwatchdog (watchdogid) { alert ("AA"); var url = ' <s:url V Alue= "/watchdog/stopwatchdog"/> '; var params = { watchdogid:watchdogid, }; $.post (URL, params, function (data) { if (data.success) { closedialog (); tbgrid.send (); } else { if (data . errormsg!= null && data.errormsg!= "") { Jalert (data.errormsg, System message); } else { Jalert ("Stop exception ", System Message"); } $ ("#saveBtn"). Removeattr ("Disabled"); $ ("#saveBtn"). CSS ("Color", "white"); } }, "JSON"); } }) ();