|Chrome Developer Tools - Console - Can you inspect a PHP var?|
No, you can't, but you are missing some basic coding and languages
fundamentals, like the difference between compiled codes and scripting
In PHP you cannot debug the code in real time like in compiled codes,
except if you configure your IDE (like PHPStorm) to make some real
time debugging, but that is an advanced task.
Supposing that you are coding on a localhost, what you can do is print
|Call Backbone view method from inside google chrome console|
You need to add the view to the global scope by attaching it to the
window.mySlider = new SliderView( el: $('.slider') );
Now you can access it in the Chrome console:
The issue that you are having is related to DOM rendering. When you
are echoing the <script> tag to the browser, the browser has not
yet fully rendered the Document Object Model. So, what is happening is
the call to document.getElementById("error") is not retuning any
results, and therefore the call to .innerHtml accomplishes nothing.
What you need to do is defer the call to document.getEle
I mainly do the following:
In synchronous public APIs I always check parameters and throw the
appropriate error. Not only TypeError but also other errors as
Generally I throw errors in exceptional cases - i.e. not fitting the
thought-out execution flow.
In asynchronous APIs I report errors via an error callback/reject
I think console.log(...) and go on is not a good idea
You could try using:
It works in Chrome, Safari, IE but not sure about Firefox.
Also, there's a new way to close windows using the new method
window.close() in the dev version of Chrome: see here.
But I recommend using the first method as it currently works.