0

I need some way to replace

https://stusys.harpercollege.edu/class-schedule/class-schedule.html?course=0008&subject=LAG&term=202095

with

https://stusys.harpercollege.edu/class-schedule/class-schedule.html?course=0008&subject=LAG&term=202090

using JS. The page is generated dynamically and now we need some one-off half-semester classes added.

Does anyone know how to swap these URLs with something I can just toss into the footer.

2
  • you want to replace this single url only with the given ? Commented Mar 30, 2020 at 18:46
  • and whats the code you have tried so far ? Commented Mar 30, 2020 at 18:46

3 Answers 3

1

Use URL():

var url = new URL('https://stusys.harpercollege.edu/class-schedule/class-schedule.html?course=0008&subject=LAG&term=202095')
url.searchParams.set('term', 100)
console.log(url)

Sign up to request clarification or add additional context in comments.

2 Comments

Lawrence I tried dropping the code into this page but it's not working for some reason. Am I missing something or have it done it wrong. harpercollege.edu/catalog/current/courses/lag.php#LAG-0008
what do you mean by dropping it into the page?
0

I dont know if I fully understand your question, but if you just are going to replace the two URLs you can use the Javascript replace method.

Comments

0

It sounds like you want a script you can drop in to your page which will dynamically change some of the hyperlinks. Since your page is already loading jQuery, this should do the trick:

<script>
    $('a[href="https://stusys.harpercollege.edu/class-schedule/class-schedule.html?course=0008&subject=LAG&term=202095"]').each(function(){
        $(this).attr('href', 'https://stusys.harpercollege.edu/class-schedule/class-schedule.html?course=0008&subject=LAG&term=202090' )
    })
</script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.