On my blog I have a lot of <pre>
blocks containing code snippets.
What I want to do is add a .click()
handler to all the <pre>
elements on the page which will send its content to another page - let's call it viewcode.php
- via POST.
I know how to send information to this page using $.ajax
, I'm just not sure how to send the information and navigate to the page.
The idea is that visitors can click a <pre>
which will navigate to another page containing the code on its own for readability and easy copy / paste.
I have a feeling the solution is dead simple and probably obvious, I just can't think of it.