By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Appending to a URL

P: n/a
I was thinking of writing a little function to help reduce the amount of
code needed in a few places.

function link(url)
{
return( url + '?-session_id=' + user.session_id );
}
Then I simply have a line like so:

x.location = link('/clientdb/newclient.lasso');

Now, here is the question... Say I have a parameter already after the .lasso
like xxx.lasso?page=123
What would be the best approach to determine that within the link function?
Look for a ? and if it finds one to append with an & rather than a ?

-S

Jun 14 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
What would be the best approach to determine that within the link function?
Look for a ? and if it finds one to append with an & rather than a ?
This should do the trick:

var ch = '?'
if (url.indexOf(ch)!=-1) {
ch='&';
}

Jun 14 '07 #2

P: n/a
Phat G5 (G3) wrote:
I was thinking of writing a little function to help reduce the amount of
code needed in a few places.

function link(url)
{
return( url + '?-session_id=' + user.session_id );
}
Then I simply have a line like so:

x.location = link('/clientdb/newclient.lasso');

Now, here is the question... Say I have a parameter already after the
.lasso like xxx.lasso?page=123
What would be the best approach to determine that within the link
function? Look for a ? and if it finds one to append with an & rather than
a ?
Yes.

Regards,
Erwin Moller
>
-S
Jun 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.