...
Code Block |
---|
<!-- In JSP page --> <!-- Store the portlet namespace string in the JSP page variable "n" --> <c:set var="n"><portlet:namespace/></c:set> <script> function doSomething() { var u = $("#{n}decentLinkName").href(); $.ajax(u, {'param1', p1,}, function() { AJAX HANDLER }); } </script> <a id="{n}decentLinkName" class="ajax_link hidden" href="/some/url" /> |
Dependent Javascript Libraries and Ajax
If you are using Ajax to update the content of the web proxy portlet, you can use the WPP's ability to do pre/post static html to pull in any specific versions of jQuery or other javascript libraries so they are loaded only once to avoid memory leaks. You can load in the specific library version in pre-processing and create a no-conflict reference, then in the post-procesing use a closure to make the reference ($ or whatever) available. See JavaScript Best Practices for additional information.