Wasim Shaikh
Wasim Shaikh

Reputation: 7030

How can I redirect the browser when a button is clicked?

I want to pass a URL on click of a button so the browser can redirect to the URL.

url value = /web/SMI6041001090/home?contId=186&contName=sa

When a user clicks on the button it should redirect to this URL.

var url = document.<portlet:namespace />regForm.fwdURL.value;
alert('url -->'+url);

jQuery('.submit-button').click(function(){
    // Pass URL here.
});

Upvotes: 1

Views: 151

Answers (1)

Sarfraz
Sarfraz

Reputation: 382796

I want to pass URL on clik of the button. so browser can redirect to URL.

You mean this:

var url = document.<portlet:namespace />regForm.fwdURL.value;

jQuery('.submit-button').click(function(){
    document.location.href = 'http://yoursite.com' + url;
});

Upvotes: 2

Related Questions