Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Can someone help with passing url variables to a button link in HTMl?

I have a page with a list of Milestones. I have a Add Milestone button on the page with this code:

<button onclick="OpenPopUpPage ('/Team/Lists/CG_Milestone/NewForm.aspx?EffortID=', RefreshPage); return false;" type="submit" runat="server" id="Button1">Add Milestone</button>

The url of this Milestone page contains a parameter identified as "EffortID". I don't know how to update the url in my code to pull the EffortID from the url. Can someone help with that?

I fail to grasp the intent of your Code it looks like a JavaScript problem to me in HTML section. You want to update the EFFORTID. Number every time someone clicks on the button? Or am i wrong?

I didn't know if I should put this in the JavaScript section, but yes, you're correct. I want to update the EffortID parameter in the url when someone clicks the button.

1 Answer

This is a problem for the JavaScript section. Anyhow, I think you should pass it a variable where you store the value of EffortID, but I don't know what the rest of the code looks like, so I may be wrong.