Recently, when a project is doing a project, I will encounter the situation where the JavaScript code will not be able to debug the JavaScript code when submitting in the sub -page. Sometimes this kind of problem, we cannot normally in the browser, see the JavaScript code on our sub -page, so only only the JavaScript code, so only only Being able to use the original alert or console.log (), of course, this is also a solution, but sometimes we want to see how the program runs, and at the same time, we can also see what the value of each parameter is, so The significance is still relatively large.
When I post a picture, everyone probably knows when it will occur.
Copy code code as follows:
<script>
Function Stopwatchdog (WatchDogid) {{
alert ("aa");
var url = '<s: url value = "/watchdog/stipwatchdog"';
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 abnormal", "System Message");
}
$ ("#Savebtn"). Removeattr ("Disabled");
$ ("#savebtn"). CSS ("color", "white");
}
}, "json");
}
</script>
This is actually a functional statement. If you understand the context of JavaScript, you know that the real function declaration is only loaded when loaded on the page and the context of the page. The function content cannot be loaded normally.
If we replace the function self -execution or define this function declaration in function autonomy, then this problem can be solved.
Copy code code as follows:
(Function () {)
Function Stopwatchdog (WatchDogid) {{
alert ("aa");
var url = '<s: url value = "/watchdog/stipwatchdog"';
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 abnormal", "System Message");
}
$ ("#Savebtn"). Removeattr ("Disabled");
$ ("#savebtn"). CSS ("color", "white");
}
}, "json");
}
}) ();