Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Append a var to url with jquery function

Tags:

jquery

url

I am looking to append a var to a url with a function that i have bounf to a click event.

Say the url is www.example.com

after running the function it becomes.

www.example.com?folder=beats

I have got the function grabbing the right folder value but need to append it to the current page url.

function fileDialogStart() {

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



}

any help

like image 906
DCHP Avatar asked Jul 04 '11 16:07

DCHP


1 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.

like image 53
MD Sayem Ahmed Avatar answered Nov 15 '22 04:11

MD Sayem Ahmed