I hit a problem yesterday in the interaction between jQuery and JavaScript, I think. It's time to ask the Scripting News brain trust to help me figure out what I'm doing wrong. Here's the page in question. Suggest you View Source. Search for the call to sendToLinkblog. I've pasted the text in below.
escapeParam is doing its job correctly on item.title, but not on item.body. I can see this by looking in Firebug, as well as in the behavior of the app. Calls to sendToLinkblog for items that have one or more single-quotes in their title fail, presumably because of a syntax error, due to the unescaped single-quotes. So the question is this -- why does the call work for item.body and not for item.title? I thought perhaps it was a type issue, that they weren't all strings, but I can't figure out what else they might be. For an experienced JS developer I'm sure this would be easy. Thanks in advance for your help! Update: Problem solved, though no one person had the answer. Nik Cubrilovic suggested adding a call to "escape" at the beginning of the escapeParam routine. But this just had the effect of doubly-encoding the params, and didn't solve what was clearly a syntax problem in the call to sendToLinkBlog. However, it gave me an idea. I could do the URL-encoding in the call to sendToLinkBlog, and solve the single-quote escaping problem, and eliminate the escaping in sendToLinkBlog. Bing! It worked. So now I'm ready to move on to the next problem/bug. Thanks as usual for the brain-trust help. |