tags:

views:

34

answers:

1

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.
});
+2  A: 

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;
});
Sarfraz
sAc, what's the difference between document.location and window.location?
fearofawhackplanet
@fearofawhackplanet: You can use either, `location` is property of `window/document` objects.
Sarfraz
@fear: *document.location* was originally read-only in some browsers. Because of this, *window.location* was always the preferred method of directing the browser to another location, but it doesn't matter so much these days.
Andy E
thanks, sAC, this what I was looking for accepting your answer.
Wazdesign
@Wazdesign: You are welcome :)
Sarfraz