My javascript is getting out of hand for my PHP application. I have 20 tags that link to various javascript files in a javascript folder. Each javascript file basically controls one element on the DOM. And, if the javascript file uses AJAX, then it will have a corresponding PHP file that the AJAX will call.
For example, a js file might control a button on the page:
$(document).ready(function () {
$("#button").live('click', function() {
$.ajax({
type: "POST",
data: ...
url: "button_click.php",
});
});
});
As you can see, this gets out of hand. What is the best way to organize all of the javascript?