0

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

1 Answer 1

2
  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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.