This might be more of a philosophical debate, but here is what I have:
- Two controls which share a Javascript resource library to call a webservice.
- They are ususally used in conjunction with each other, but not always.
- The javacsript file they both reference is not easily separated.
- The javascript file should not be added to every page in the application.
Ideally I would divide the webservice between the controls and have each call a js resource file targeted just to the functionally they need.
I'm wondering if there is an obvious better way that I'm missing...
In its simplest form I have:
<html>
<head>
</head>
<div>
<h1>Control1</h1>
<script type="text/javascript" src="/Webservice.asmx/js"></script>
</div>
<div>
<h1>Other stuff</h1>
</div>
<div>
<h1>Control2</h1>
<script type="text/javascript" src="/Webservice.asmx/js"></script>
</div>
</body>
</html>
Edit
I have jQuery available to me if this provides a helpful method.
Using ASP.NET