Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to call hamlet from JavaScript?

I'm trying to implement this nav bar on my Yesod web app. My question how should I call a hamlet file from the javascript?

.....
.....
var Tabs = {
    'Tab one'   : 'pages/page1.html',
    'Tab two'   : 'pages/page2.html',
    'Tab three' : 'pages/page3.html',
    'Tab four'  : 'pages/page4.html'
}
.....
.....

As you can see it's calling the html pages with relative pathing, how do I do something like $(widgetFile "mypage")?or @{MyPageControllerR}?

like image 393
HHC Avatar asked Jun 19 '26 18:06

HHC


1 Answers

I suggest to you write as html

<ul>
    <li>
      <a href="@{...}" ...

You can write as javascript using julius, in that case some like

var Tabs = {
    'Tab one'   : '@{MyPageController1R}',
    'Tab two'   : '@{MyPageController2R}',
    'Tab three' : '@{MyPageController3R}',
    'Tab four'  : '@{MyPageController4R}'
}
like image 185
josejuan Avatar answered Jun 22 '26 07:06

josejuan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!