I need to replace a slash with a hash in a URL. Everything else stays the same.
e.g.:
this:
www.example.com/main/events/event-1
needs to be changed to this:
www.example.com/main/events#event-1
(jQuery solution is optimal, plugins OK)
Update based on OP's comment:
Using this code:
function outputStatus(e)
{
if (e.success && $.url.segment(1) == 'events')
{
// IF Flash SWF loads success AND on events page
var url = $.url.attr('source'); // gets current URL
var new_url = url.replace(/\/([^\/]+)$/, "#$1"); // replaces last slash with a hash
window.location = new_url; // sets the current URL to the new URL
}
}
The URL is getting changed twice (so www.example.com/main/events/event-1
is becoming www.example.com/main/events#event-1
and then www.example.com/main#events#event-1
).