I am not finding a solution on this one using JavaScript (to utilize localStorage) in a JSP.
Trying to pass something with apostrophe. I have done a .replaceAll() and replaced the ' with ' and it still passes it as an '.
I have also tried a .split("'") and replaced the apostrophe with:
(\' , ' , \', '' , ''' and '\'')
All of these just pass an apostrophe to the function (what I see when I hover over the link) like this:
<a href="saveJob('<%=id%>','<%=title%>','<%=a%>' + '\'' + '<%=b%>','<%=date%>')">Save job</a>
With a and b being the two split substrings but with no effect. I do notice that spaces are converted into %20, but that's little comfort. Any other ideas?
.replaceAll("'", "\\\\'");got me what I needed in the short term. I am not sure which answer to accept as the "Accepted Answer", as I'm torn. Both answers were thoughtful and are viable. Thanks for letting me know there is a better way to do it. Looks like I have some reading to do. I will be looking into JSON objects either way, and am really curious about the phrase "abusing an HTML anchor as a trigger" and what the technical reason is for why doing this is a bad thing?