Mi spiegheresti che vuol dire...

location.search().substring(0,3)

come lo devo motificare?... non so proprio niente.