Javascript fetch-api issue with # or %

Viewed 25
const response = await fetch(
        `${ENV().API_BASE}/Panel/Details/PanelId/${
          model.panelId
        }/Password/${model.Password}
        }`,
      );

Also if the user inputs in "%%" I get an error saying Json Parse error. Unrecognized token "<".

Does anyone know the best way of passing these symbols in the model.panelpassword?. Thanks

1 Answers

I was able to pass the data into the url using this method encodeURIComponent

Related