[Coldbox 4.2] hashtag in SES URLs

12 views
Skip to first unread message

Eric Gutke

unread,
Dec 22, 2016, 10:07:44 AM12/22/16
to ColdBox Platform
I've searched here and the web and haven't found anything on this. In my site I'm building with SES URLs and a bootstrap theme (SmartAdmin/Ajax), it uses # values in the URL to Ajax lazy load page content without refreshing the whole page. DefaultEvent is "" but main.index loads the main page. It works fine while the URL is alpha.mydevsite.com/#ajax/dashboard where I have a separate handler called Ajax for those events. However on login, security is defaulting to forward to alpha.mydevsite.com/main/index#ajax/dashboard where I am getting an error on the content load because it is looking for the event main.ajax.dashboard. It's as if the IIS URL rewrite is removing the "index#". If I could always ditch the "main/index" I think I'd be ok.

Maybe I'm approaching this the wrong way and should scrap the SmartAdmin lazy loader JS and write my own Ajax calls in CF. That would certainly be cleaner but a lot of customization of the theme's code.

Thanks in advance.

Jon Clausen

unread,
Dec 22, 2016, 10:13:25 AM12/22/16
to col...@googlegroups.com
Eric,

Anything after a hashtag in a URL is not parsed by the server, as it is not part of the header sent to the server (Open your web inspector console and look at your request headers).

If you want to evaluate those via javascript you’ll need to do those via the `window.location.hash` variable.

Thanks,
Jon
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/9c7fe20c-82d2-4970-9459-e7b21b216480%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Eric Gutke

unread,
Dec 22, 2016, 10:21:40 AM12/22/16
to ColdBox Platform
Jon, thanks. The JS included in with the theme takes care of parsing the # and fetching the page content. My main issue is figuring out why it's trying to get an event called "main.ajax.dashboard" instead of just "ajax.dashboard". This may give me a hint where else to look though.

Jon Clausen

unread,
Dec 22, 2016, 10:37:54 AM12/22/16
to col...@googlegroups.com

It’s most likely because your default route assigns the handler “Main”.  You’ll need to check your routes file to add specific default routes for any handlers in the “ajax” directory:

 

```

addRoute(

pattern="/ajax/dashboard/:action?",  
handler="ajax.Dashboard",

     action="index",

);

```

Reply all
Reply to author
Forward
0 new messages