I have this function for my sql javascript
PATH="http://localhost/dhodia/";
try{
var tags=url.replace(PATH,"");
var spl=tags.split("/");
if(spl[0]=="i"){
if(spl.length>=2 && spl[1]=="hdd"){
}
addtoopen($("#"+spl[1]+"opn").attr("jso"));
menu_action(spl[1],url)
}
}catch(err){
var txt="There was an error on this page.\n\n";
txt+="Error description: " + err.message + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
i found there is problem at replace statement
if i use url as “http://localhost/dhodia/i/hdd” it will do replace
but if i use “http://localhost/dhodia/i/hdd/tarun” it is not doing replace
i want to track why it is not taking replace at this line
EDIT
I am using this in function as shown below
function hstppst(url){
config.pre=url;
if(url==PATH || url==PATH+"i/dashboard"){
$E("#"+current.open).hide();
unfixbox()
$E("#dashboard").show();
addtoopen(dsjsn);
document.title="My DashBoard";
current.open="dashboard";
}else{
var tags=url.replace(PATH,"");
var spl=tags.split("/");
if(spl[0]=="i"){
if(spl.length>=2 && spl[1]=="hdd"){
}
addtoopen($("#"+spl[1]+"opn").attr("jso"));
menu_action(spl[1],url)
}
}
}
and this function call when window.onpopstate changes
in onpopstate i pass url to this function
problem is that code is not executing after var tags=url.replace(PATH,""); and because i am using this function in onpopstate function if any error occurs poage refreshed and i am track what is error i am getting.
Please take a look at the usage of replace method of the string object:
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace
You mistakenly use replace.