Add var to url with jquery function

I want to add var to the url with a function that has a bounf for the click event.

Say URL: www.example.com

after starting this function.

www.example.com?folder=beats

I have a function capturing the value of the right folder, but you need to add it to the current URL of the page.

function fileDialogStart() {

$folder = $('#ams3Folder').val();



}

any help

+5
source share
2 answers
function fileDialogStart() 
{
    var newURLString = window.location.href + 
            "?folder=" + $('#ams3Folder').val();

    window.location.href = newURLString;    // The page will redirect instantly 
                                            // after this assignment
}

For more information, go here .

+8
source
function fileDialogStart() {

$folder = $('#ams3Folder').val();

window.location.href = window.location.href + $folder

// window.location.href = window.location.href + '?test=10';

}
+3
source

All Articles