0

In my view im passing a modelAttribute value in the URL as a parameter in an event on a mouseClick.

code snippet :

<li><a data-toggle="tab" onclick="loadOrders()">Orders</a></li>

<script type="text/javascript">
     function loadOrders() {
        window.location = '/admin/business/${businessId}/order?'+encodeURIComponent('appType=${appType}&appName=${appName}').replace(/'/g, "''");
    }
</script>

so when the parameter appName have an apostrophe or any other tricky character i'm having Uncaught ReferenceError: loadOrders is not defined at HTMLAnchorElement.onclick error on the browser console. Eventhough here i'm trying to replace the character i'm still getting the error. How to resolve this and pass the parameter in the URL with encoding correctly?

GeekySelene
  • 847
  • 3
  • 13
  • 31

0 Answers0