This is happening because you have click event firing on ID
jQuery('#przyciskUlubione').click(function() {
The ID is always unique, there should never be more than one same ID in the HTML.
You can achieve this using class. Assign the same class to all the buttons.
Change your selector to class:
jQuery('.przyciskUlubione').click(function() {
add value attribute or data attribute to your buttons.
Now, When you will click on any button the click event will be triggered. You now need to fetch value using this
.
Next step: replace your line
$("#przyciskUlubione").val()
With this:
$(this).val()
This should work properly 🙂
Related Posts:
- Change “add to cart” button color based on Woocommerce product category [closed]
- Function won’t run onclick using Ajax
- Cannot access $wpdb, comes back NULL
- How can I fetch loop of post titles via AJAX?
- How build a custom login/register form with error handling?
- Is having multiple theme customizers for different pages possible?
- Where to include php files in wordpress and how to refer to them later [closed]
- Admin Media grid view images won’t load
- Passing JSON data from WP Query into AJAX causing NULL errors
- AJAX / Read More: multiple check_ajax_referer() and wp_create_nonce() not working independentely
- Handling an Ajax form submit
- Ajax call to my WordPress website from an external application [duplicate]
- Validate a users email address when using gmail to register
- Custom WordPress+PHP+MYSQL+AJAX form, submit event not captured by Javascript, but does POST data to the DB
- Use ajax to update_post_meta
- WooCommerce: update custom fields after checkout validation failure
- How to speed up admin-ajax.php in wordpress
- Can I use HTTP POSTs? Is there a better alternative?
- How to make custom total price reactive in navigation
- Displaying a button on each post
- Using Multiple Submit buttons to trigger customised php functions
- How to test nonce with AJAX – Plugin development
- Insert a button on a page with random number generation
- get current custom post ID by WP_Query method
- Ajax not working es expected (Returns 0)
- Creating a Multi-Level Associative Object Using AJAX
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- adjust section according to country?
- Posting and image insertion problems after EasyApache4 and PHP 7 upgrade
- Ajax call return 404
- How to add a do_action on refreshing of WP customizer?
- how to update and display an option without reloading the page
- Pull GetOption() variable into jQuery dynamically created html
- element not working in Safari [closed]
- WordPress comment submit button substitutes/options
- WordPress plugin admin page – using WordPress function in linked php file
- Load Posts on Click via Ajax into a DIV
- Use value from Ajax call in PHP function
- How to remap one of the TinyMCE Advanced Editor button to open the wordpress media library?
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- A $_POST should occur when submit form but is not?
- Shortcode to pull posts
- Ajax search shows all results when user empties input?
- Why i can’t get custom fields value or post ID via Ajax?
- SOAP Request/Parsing XML From wp_send_json_success
- Get uploaded image and attach it to the new post
- Admin-ajax php not working on new wordpress version
- Errors being created by admin-ajax.php
- Convert canvas to image and upload image to server
- Can’t pass the variable from a select to PHP query
- Add a counter for mouseovers (custom field)
- Accessing an API with jQuery and AJAX
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- Ajaxurl suddenly not defined
- PHP: How to access db the right way in plugin?
- How to split AJAX response into two divs
- How to set variables with AJAX request to use in another function in WordPress
- How to use wp_send_json() and output the value with ajax?
- Is it possible to access admin-ajax.php using PHP?
- Store ajax data in PHP variable
- Ajax result show in console if is called outside function and not showing in array
- How to change PHP variables with AJAX request in WordPress
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- How can I get my WordPress plugin to receive data and relay it in an ajax/php request to a remote server that requires authentication?
- 400 bad request admin-ajax file upload
- wp_ajax_ 400 Bad Request
- update_post_meta Not Processing Array Data (Not Sure What I Am Missing)
- WordPress AJAX PHP(html) file that is within WordPress Loop
- Why the responseText containing those two arrow signs at the beginning
- Cannot transfer ajax post data from js to php file
- WordPress Ajax filter: Create two loops for different output styles?
- Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
- Input field duplicates on form submit by jQuery
- Following/Followers Users list Using Ajax Pagination inside Author Profile
- How to echo a PHP code into WooCommerce variation product?
- How to call a function from functions.php with ajax?
- Ajax in a class instantiated via shortcode
- Custom Post type Ajax search results
- Ajax wordpress function showing source code in alert and not value of input field?
- Problem with ajax request and directory structure after site migration
- Find the method which AJAX GET calls
- Code works on page-example.php by not category-example.php
- Retrieve $_POST data to send to javascript without using localize script
- ajax form with multiple submit buttons and values
- How to run ajax in WordPress Post?
- Modify php code to pass a page id as a parameter in order to create a breadcrumb
- Add php function into .js file (for tinyMCE button)
- WordPress will suddenly stop saving files uploaded by my code (ran in nopriv ajax)
- ajax form function error
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- send meta box input data without publish button
- wp_enqueue_scripts with JS script as a string
- How to use url and amin-ajax.php
- WP – Ajax call back data printed in the console.log
- How to Set Page Pagination Using Ajax JQuery – WordPress
- How to pass and validate nonce in custom REST routes
- ajax problems on loading page [closed]
- Woocommerce – Include custom user meta in order ‘filter by registered customer’ Ajax search
- AJAX WP_Query’s order and orderby parameters not working
- How can I use AJAX in child theme template?