0

I have the url parmeters http://www.nositeinparticular.coom/product1?test=brand&old=Superman&new=Batman.

I was wanting to know the proper way to use javascript to do the following;

Look to see if test=brand If it does replace all the values of old with the value of new, ie replacing the word Superman with Batman.

I have this so far to see if test equals brand:

$(document).ready(function() {
    var url = location.pathname;

    if (url.indexOf("test=brand")) {

    }

How would I go about parsing the values from the url and running the replacment?

JJJ
  • 32,902
  • 20
  • 89
  • 102

0 Answers0