How to debug a script inside partial view that load by javascript in Chrome Developer Tools?

1.2k views Asked by At

When I loaded html file that contains javascript code by using the following code

$("#containerId").load("@Url.Action("ActionName")");

I couldn't find it in the chrome source tab I find out chrome renames js-loaded file to something like "VM27123" that the number changed by every refresh and chrome does not show these files in search result

so how can I find them and set breakpoint on it?

1

There are 1 answers

0
ali-myousefi On

omatase's answer:

use the syntax:

//# sourceURL=fileName.cshtml

immediately after opening your script tag. Example:

<script type="text/javascript">
    //# sourceURL=fileName.cshtml
    function foo() {}
</script>

and you can find your javascript in sources tab on debug mode by fileName