Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug javascript returned from server after ajax call in Chrome debugger [duplicate]

I have an ajax call that returns a html view like so:

$.ajax({
            url: 'process.php',
            type: 'post',
            data: {
                action: "data",
                view:"data",
            },
            success: function (data) {
                $("#someDiv").html(data);
            }
        });

The view contains some javascript like so:

<script type="text/javascript">
    $(document).ready(function () { 
        var x = $("#something").val();
    });
 </script>

Now, is there a way to set a breakpoint on the line var x = $("#something").val(); in Chrome's debugger? If not, is there any other way to debug this kind of code? at the moment im only using alert()'s.

Thanks in advance

like image 349
Notaras Avatar asked Sep 06 '25 03:09

Notaras


1 Answers

use debugger

debugger; //this will stop and pause your project
var x = $("#something").val();
like image 184
yangli-io Avatar answered Sep 07 '25 20:09

yangli-io