I'm currently working on a project with Kendo UI, jQuery and Symfony 1.4 and I have some global variables.
<script type="text/javascript">
var addURL = '<?php echo url_for('dashboard/addEmployee') ?>';
var deleteURL = '<?php echo url_for('dashboard/deleteEmployee') ?>';
var editURL = '<?php echo url_for('dashboard/editEmplouee') ?>';
var viewURL = '<?php echo url_for('dashboard/viewEmployees') ?>';
... some other URLs follow here.
</script>
And I would use those variables as follows:
$.ajax({
url: addURL,
.. other options here
});
Let's say for example that I have many global variables maybe a hundred, do I need to worry about "destroying" those variables? Since I read somewhere that javascript is garbage collected. Will those variable be collected by the GC when I change the page?
And lastly about with kendo UI, I'm using the Kendo UI widget Window to act as a dialog in my project, how would I handle the dialog after it is closed? Because I'm reusing the same dialog all around from information messages to error messages. Is it lost/destroyed (out of scope) if the click handler of an element is over?