How to display checked posts on another page over AJAX? (like comparasion style)

I wanted to create an "comparasion" model for my WordPress Website, but gone bad at that.

I cannot figure out how to ...

On one page I have displayed post (custom post type, ex. "Products"). Next to the title of the post (product) is an checkbox.

If user has checked for example two posts/products (ex. product a and product b), how to retrive the value (the $post->ID) of each checkbox or over ?

How to save that checked $post->ID of product a and product b for later use in AJAX?

Should I retrive them over jQuery .click() function?

And last, after click on link or button, how to parse and display those two selected posts (ex. title and content) on separate page, over AJAX? Is that possible?

Short version: User checks two posts, hits the button and those checked posts are displayed on another page.

Any help would be appreciated!

Regards

Topic comparison ajax jquery plugins Wordpress

Category Web


  1. Add data-post_id attribute to checkbox and fill it with corresponding post ID.
  2. On click on compare button (link) retrieve all post ids from checked checkboxes with JavaScript (jQuery)
  3. Redirect to the comparision page with post IDs in url as GET parameters. This is just one scenario how your task could be done.

PS your question is not related to WordPress itself but is form field of web application architecture.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.