I can't seem to figure out the Chrome debugging tool.
I have chrome version 21.0.1180.60 m.
Steps I took:
I also noticed that the Watch Expressions don't work either. It keeps telling me that the variable that I want to watch is undefined.
Further testing found that it's my code that's causing the breakpoint to fail. It seems that it fails on the "$("#frmVerification").submit(function(){" line. It doesn't step into the breakpoints inside that function().
Below is the:
//function to check name and comment field var test = "this is a test"; var test2 = "this is another test"; function validateLogin(){ //if(userEmail.attr("value") && userPass.attr("value")) return true; //else //return false; } //onclick on different buttons, do different things. function ajaxRequest(){ } $(document).ready(function(){ //When form submitted $("#frmVerification").submit(function(){ var username = $("#username"); var token = $("#token"); var action = $("#action"); var requester = $("#requester"); if(validateLogin()){ $.ajax({ type: "post", url: "verification.php", data: "username="+username.html()+"&token="+token.val()+"&action="+action.val()+"&requester="+requester.val(), success: function(data) { try{ var jsonObj = $.parseJSON(data); //convert data into json object, throws exception if data is not json compatible if(jsonObj.length > 0){//if there is any error output all data var htmUl = $('<ul></ul>'); $.each(jsonObj, function(){ htmUl.append('<li>' + this + '</li>'); }); $("#errOut").html(htmUl); }else{ alert("Your account is now activated, thank you. If you have already logged in, press OK to go to the home page. If not, you must log in first."); window.location.replace("home.php"); } } catch(e){//if error output error to errOut] $("#errOut").html("PHP module returned non JSON object: <p>"+data+"</p>"); } } }); } else alert("Please fill UserName & Password!"); return false; }); });
Press the F12 function key in the Chrome browser to launch the JavaScript debugger and then click "Scripts". Choose the JavaScript file on top and place the breakpoint to the debugger for the JavaScript code.
In the debugger window, you can set breakpoints in the JavaScript code. At each breakpoint, JavaScript will stop executing, and let you examine JavaScript values. After examining values, you can resume the execution of code (typically with a play button).
To enable the new multi-target debugger in VS 16.7 or newer please go to Tools -> Options -> Debugging -> General -> and check the option: “Enable using the multi-target JavaScript debugger for debugging JavaScript in ASP.NET projects (requires debugging restart)”
I'm not sure why your breakpoints aren't hitting, but one sure-fire way to step into your code is to type
debugger;
where you want the code to halt, and then run again with the chrome developer tools window open.
Just one small thing to be aware of, be sure to clean up after you done and remove the debugger lines. If you ever run JavaScript files through YUI compressor, the existence of a debugger;
line will cause it to error out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With