Click here to Skip to main content
16,004,820 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Using the following to load images base on two ids one is the and bookid and the out is the client.
My folder structures is this.
root path = flipbooks

subfolders under flipbooks are books and clients

in subfolder books I have and .net page title tablet.

the tablet code behind checks the bookid of client and render a the tablet page with images in a flipbook fashion.

because we have over 15000 records and flipbooks already created and stored in the database. I don't move the client folder under the books subfolders. I need the code below to get to the client subfolder in the query string and help to change this would be helpful.

The result now is http://www.somewebsite.com/books/client/images/someimage1.jpg[^]
I need the results to be http://www.somewebsite.com/client/images/someimage1.jpg[^].

I tried moving the tablet.aspx file to the root flipbooks and it works but i have provide a user name and password each time. This need to be access by the public and my root is protected. Don't want to have to change permission.
JavaScript
//function getParameterByName(name) {
//    name = name.replace(/[[]/, "\\\[").replace(/[\]]/, "\\\]");
//    var regexS = "[\\?&]" + name + "=([^�]*)";
//    var regex = new RegExp(regexS);
//    var results = regex.exec(window.location.search);
//    if (results == null) {
//        return "";
//    }
//    else {
//        return decodeURIComponent(results[1].replace(/\+/g, " "));
//    }
//}

Change the code to
JavaScript
function getParameterByName(name) {

    var results = RegExp('[?&]' + name + '=([^&]*)')
                    .exec(window.location.search);

    return results ?
        decodeURIComponent(results[1].replace(/\+/g, ' '))
        : null;

}

Thanks Mission Critical
Posted
Updated 22-Sep-12 9:17am
v3
Comments
Zoltán Zörgő 22-Sep-12 13:09pm    
So you just want to eliminate the "/books" from the beginning of the path? Could happen to have "/books/" anywhere else in the path?
postonoh 22-Sep-12 15:59pm    
yes
Zoltán Zörgő 22-Sep-12 16:06pm    
I had two questions. And you replied with one "yes". Which of them is "yes"? Or both?
postonoh 22-Sep-12 16:48pm    
Yes to the removing the /books at the beginning path. I can post all my code not alot.

thanks by the way
postonoh 22-Sep-12 20:19pm    
How would I strip the /books out my url. using javascript

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900