---
schema_version: "1"
id: 720f4985969dcff8689a331dd2753e1e9d3ed34fc52d62efb7e360d248ef5b8f
title: Debugging JavaScript Remoting
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/javascript/pages-js-remoting-debugging-response.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-js-remoting-debugging-response.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0e2e2ebc6c2390521a79c8719d6ac0d4ed017d2c74c48ae3327c807cc88ce119
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Debugging JavaScript Remoting

Debugging pages that use JavaScript remoting requires you to debug Visualforce, Apex, and JavaScript.

**important:** Keep your JavaScript console open during development when using JavaScript remoting. Errors and exceptions encountered by JavaScript remoting are logged to the JavaScript console, if enabled, and are otherwise silently ignored.

When a `@RemoteAction` method throws an exception due to a programming error or other failure, the Apex stack trace is returned to the browser within the `event` object. Inspect the stack trace in a JavaScript debugger console or use it in the error handling of your response callback function.

Here’s a callback function that simply displays the stack trace when there’s an exception.

<!-- otherprops: set_clipboard -->
```javascript
<script type="text/javascript">
function getRemoteAccount() {
    var accountName = document.getElementById('acctSearch').value;

    Visualforce.remoting.Manager.invokeAction(
        '{!$RemoteAction.MyController.getAccount}', 
        accountName, 
        function(result, event){
            if (event.status) {
                document.getElementById('acctId').innerHTML = result.Id
                document.getElementById('acctName').innerHTML = result.Name;
            } else if (event.type === 'exception') {
                document.getElementById("responseErrors").innerHTML = 
                    event.message + "<br/>\n<pre>" + event.where + "</pre>";
            } else {
                document.getElementById("responseErrors").innerHTML = event.message;
            }
        }
    );
}
</script>
```

