0

While debugging I got this error in my below part of code..

 queryStirngValue = document.referrer.split("myQuryString")[1].split("%")[1].split("253D")[1];
    alert(queryStirngValue);
1
  • 1
    Seems look like you having blank value in string and you are trying to perform split operation. can you check what you get in document.referrer? Oct 13, 2015 at 5:03

1 Answer 1

1
 document.referrer.split("myQuryString")[1].split("%")

You first split on myQuryString (which by itself is misspelled?)

With [1] you then want the second array value (because arrays start at 0)

So if myQuryString is not in the QueryString you now have a null value

So

null.split("%")

causes: Uncaught TypeError: Cannot read property 'split' of undefined(…)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.