views:

37

answers:

1

I have a hosted Q&A site that I'm looking to augment with additional features not provided by the host. I'm comfortable implementing the server-side features (they should take me around 6-8 weeks), but I'm not able to modify the Javascript that handles the posting of questions/answers.

I'm puzzling over how to add extra scripts that can implement the hooks to allow the additional features to work. I want to add code that can determine when a post has been submitted and notify the external server of the change so that it can do its business.

I want to avoid any processes that rely on repeatedly scraping the pages as I'm charged by page view, so I've been looking at adding an AJAX call to notify the server that a change has been made.

I am able to add Javascript to the pages and can use jQuery, but I don't know how to implement the processing so that after each successful post (submission of new or edited question or answer) a message is sent to update the additional server, while avoiding submissions when validation errors occur.

Any pointers or suggestions for alternative approaches would be gratefully received.

+1  A: 

Can you stick javascript on the page that hosts the posted question (not the question posting form, but the actual question page)? Have a script that pings your server with some sort of unique identifier for a question every time a question is viewed. Your server can then see if it already "knows" about the question. If it doesn't, then the question is a new one and you can take the desired action.

Obviously your system would never learn about questions that never got viewed, but I'd imagine most people would look at their questions after posting them.

Aaron
This may work, after posting a question the next page shown is the result of the update
Rich Seller