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 trialTherman Trotman
Courses Plus Student 376 PointsJavaScript to support related tables/lists in SharePoint.
Guys, need help with JavaScript. Forgive me if I don't even ask this correctly. Scenario: Imagine a list of musical artists on a web page. Each artist is a line item. Each line item has a link to "details" of each artist. If I clicked the details button, I'd like to open another page and see Albums, Concert dates, Interviews and Videos. The Albums, Concert dates, Interviews and Videos are all in their own separate tables behind the scenes. In addition, I'd like to (while on the details page) add an item. For instance, I'd like to add a new album. I need to let the system know that this new album I'm adding must be attached to the artist that I clicked on back on the Artist page.
Here's what I'm asking: Can the details page have this URL (or similar): website.com/Details?ArtistID=1 And if so, can I pull the ID from the URL and place it in the appropriate field when adding an album? And finally, if that's the case, how do I do that?
Thanks for any help you guys.
1 Answer
miikis
44,957 PointsHey Therman,
It sounds like what you're mainly asking is how to parse a given window's URI for a specific query parameter. It sounds like you subsequently want to combine this parameter into some sort of POST request to a database.
You can use the DOM's URL API for the first part of that. That API should allow you to easily get the parameter that you need. Once you have that parameter, it's just a matter of bundling it up in your POST request using whatever mechanism you feel like using.
Therman Trotman
Courses Plus Student 376 PointsTherman Trotman
Courses Plus Student 376 PointsThank you. I'm still very new to JavaScript so I'm still learning, but this was helpful. I was trying to get an understanding of what I was supposed to do and if it was a legitimate way to do it. Sounds like it is so thanks again.