2

I have the following URL file.cfm#widget=details?id_code=123

I'm trying to display or use the id_code var... <cfoutput>#url.id_code#</cfoutput>

But it gives me the error Element COURSE_CODE is undefined in URL.

Any help would be great.

Thanks

elixireu
  • 235
  • 1
  • 14
  • 1
    id_code or COURSE_CODE? Which variable are you really trying to set and output? That error would not be produced based on the code I have seen. – TRose Nov 23 '16 at 11:16
  • Sorry, the error it gives me is Element ID_CODE is undefined in URL. – elixireu Nov 23 '16 at 11:23
  • it might be the #widget=details is messing things up so that cf doesn't even get the id_code – luke Nov 23 '16 at 11:34
  • yeah, i just checked locally, and that #widget-details is meaning cf doesn't get the id - usually in urls the # would be at the end - like file.cfm?id_code=123#widget-details – luke Nov 23 '16 at 11:36
  • The vars after the # in the URL come in from javascript, is there a way I can use those vars in coldfusion? – elixireu Nov 23 '16 at 12:46
  • 1
    can you put the # after the ? like file.cfm?id_code=123#widget=details - then cf can get the id_code like normal, at the moment with file.cfm#widget=details?id_code=123 cf isn't getting anything after file.cfm – luke Nov 23 '16 at 13:04
  • @elixireu How are you generating this URL? `id_code` is part of url hash *not* param. – Beginner Nov 23 '16 at 13:10
  • 2
    What do you see when you do this? `` – Dan Bracuk Nov 23 '16 at 13:41
  • This javascript you mentioned. Why is it doing what it's doing? – Dan Bracuk Nov 23 '16 at 17:34
  • Hi Dan, `` displays nothing, but `` displays the var I need - 1st column, `'struct' 'CFQUERY.EXECUTIONTIME' 'DBFIELDCOURSES'` 2nd column displays the vars `'n^id| t^title| t^subtitle| t^code'` I hope you follow me. – elixireu Nov 24 '16 at 08:34
  • The javascript is calling an API to display the data, but uses the var ID in the URL to display the correct data. – elixireu Nov 24 '16 at 08:36

1 Answers1

1

This is called a Fragment URL. Unfortunately, this (and everything behind it) isn't passed in your HTTP request, and isn't readable by your server side ColdFusion code.

Can I read the hash portion of the URL on my server-side application (PHP, Ruby, Python, etc.)?

Community
  • 1
  • 1
JDev
  • 166
  • 1
  • 9