-
|
My app is using url rewriting. However, the test server is not so I can't hard code any url href values since on the test server it will have "index.cfm/" inserted into the URL rendered. I have been getting around this by using urlFor method to take care of when to insert the index.cfm or not to. It works great AFAIK. Now I have a situation where a select tag calls a JS function to handle the changed value and to call the current url but with a new key obtained with jQuery val(). I can't figure out how to use the urlFor and satisfy it's need for the new key value. Here's the function called by the select tag: This does not work as it generates an error that the key parameter is required for the url. I think urlFor is not the right approach in this situation but as a new Wheels user, I'm not sure what is the right approach. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Since the page is rendered in CF at page load, it's not clear that there is a way to change the key param value in the href path construction. What I think I need is a way to construct the full path without the key, then provide that path (which is not dynamic in this situation) in the JS script to use for appending the dynamic key value obtained upon change in the selection of the select tag. Is there a Wheels way to get that base path (full path minus the key)? |
Beta Was this translation helpful? Give feedback.
-
|
I have found that if I create a new route for user.AdminEdit without the key requirement, then I get the base URL and can append it in jQuery in this way: This is working for me. I don't think it presents a security hole since the original route throws an error if the user removes the key value from the URL in the browser. Yet this allows the jQuery code to get the base path without a key. |
Beta Was this translation helpful? Give feedback.
-
I'd be looking at getting that sorted out sooner rather than later. A test server should be as close to prod config as poss, otherwise it's merit as a test env is diluted a bit. |
Beta Was this translation helpful? Give feedback.
I have found that if I create a new route for user.AdminEdit without the key requirement, then I get the base URL and can append it in jQuery in this way:
This is working for me. I don't think it presents a security hole since the original route throws an error if the user removes the key value from the URL in the browser. Yet this allows the jQuery code to get the base path without a key.