Q: How to Use 1 file for different Action? I have 2 files, there are Index.aspx and AdminHome.aspx. and also have javascript file (test.js) for logic behind.
Index and adminHome is actually same but the different is only the redirect action.
If I run program from Index.aspx then i'll be redirect to CheckSeat.aspx
If I run program from AdminHome.aspx then I'll be redirect to AdminCheckSeat.aspx. I want to use same Javascript because each file has same logic. only the redirect file is the different.
this is my redirect code on .js
var url = "CheckSeat.aspx?noSeat=" + encodeURIComponent(lObjSeat[0].Name) + "&endtime=" + encodeURIComponent(time);                 
    window.location.replace(url);

so Is it possible to do ?
if ya, How do you do ?

example URL : http://localhost90909/abcd/index.aspx

I need 'index.aspx' segment only

A: You may replace the url based on current page.
if (document.URL = 'Index.aspx') {
    var url = "CheckSeat.aspx?noSeat=" + encodeURIComponent(lObjSeat[0].Name) + "&endtime=" + encodeURIComponent(time);
    window.location.replace(url);
}
else if (document.URL = 'AdminHome.aspx') {
    var url = "AdminCheckSeat.aspx"
    window.location.replace(url);
}

