I'm looking to create a bookmarklet that takes a selected word and the other words in the same paragraph element, encodes them, and sends them to my server.
For instance, consider the following:
<p>The quick brown fox jumped over the fence.</p>
Had the user selected "jumped" (by highlighting it) and clicked the bookmarklet, I would want to send "jumped" as one encoded string and "The quick brown fox jumped over the fence" as an additional encoded string.
Here's what I've got thus far. The getSelection function sends "jumped" to my service:
javascript:location.href='http://www.myservice.com/new.php?'+'url_def='+encodeURIComponent(getSelection())
What can I append to this in order to get the additional text in the paragraph element to my service?