title: How to debug a javascript undefined error in third party code.
body: <p>So I am using tinyMce in my app but I am getting a JavaScript error that I can't really seem to figure out how to debug. The error is "TypeError: P is undefined" - I can see that from FireBug but I have no idea how to get more / better information? </p>
  
  <p>I tried turning on "break on all errors" but that just shows me the minimized JS file and I can't even see a variable named "P" in there so I am guessing I am barking up the wrong tree. The whole thing works fine except when I click save. </p>
  
  <p><em>shrug</em> I am just stuck at the moment. Here is my complete code. you can see I tried removing all the plugins thinking that might be it but no dice. </p>
  
  <p>Obviously the problem I need to solve is why that is happening - the better solution would be how to figure out what is actually causing it so when something like this happens again I can figure it out myself. </p>
  
  <p>Thanks - see the complete code below. </p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;dynamic&gt;" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"&gt;
  
      &lt;script type="text/javascript"&gt;
          $(document).ready(function() {
  
              $('textarea.tinymce').tinymce({
                  script_url: '/Scripts/TinyMCE/tiny_mce.js',
                  theme: "advanced",
                  plugins: "save",
                  theme_advanced_buttons1: "save",
  //                plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
  //                theme_advanced_buttons1: "save,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bold,italic,underline,strikethrough,|,print,|,iespell",
                  theme_advanced_toolbar_location: "top",
                  theme_advanced_toolbar_align: "left",
                  theme_advanced_statusbar_location: "bottom",
                  save_enablewhendirty: true,
                  encoding: "xml",
                  theme_advanced_resizing: true,
                  mode: "textareas",
                  save_onsavecallback: "ajaxSave",
                  setup: function(ed) {
                      ed.onSaveContent.add(function(i, o) {
                          o.content = o.content.replace( /&amp;#39/g , "&amp;apos");
                      });
                  }
              });
  
              function ajaxSave() {
                  alert("ajaxSave called.");
              }
  
          });
  
      &lt;/script&gt;
      &lt;% Html.BeginForm("Index", "DisabilityReport", FormMethod.Post); %&gt;  
      &lt;%= Html.AntiForgeryToken() %&gt;
      &lt;%= Html.ModelData() %&gt;
      &lt;textarea name="documentContent" class="tinymce" cols="90" rows="60"&gt;&lt;/textarea&gt;
      &lt;% Html.EndForm();%&gt;
  &lt;/asp:Content&gt;
  </code></pre>