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
- Data insertion after clicking a button does not work (script, AJAX, PHP)
- How do I Import / Upload Files with jQuery AJAX?
- WordPress admin-ajax.php 400 bad request
- WordPress Ajax Call inserting data but success response false
- Loading php file with AJAX in WordPress frontend
- wp ajax return 0
- Ajax contact form return 0
- WordPress plugin: render only page content using ajax call
- AJAX – Returning Two JSON Objects with One PHP Function
- Pull GetOption() variable into jQuery dynamically created html
- Get the URL of the page from which an ajax request has been launched within ajax callback
- unable to use ‘new WP_Query’ in AJAX call
- admin-ajax Firing Error 400 When Logged In
- is_user_logged_in() not working in AJAX validation call
- Unset session variable on page reload / setup but exclude AJAX
- element not working in Safari [closed]
- Add Ajax Hooks and Call from Custom Template PHP
- WordPress ajax-action failing because of newline in response
- Making an AJAX call to refresh a table
- HTML escaping data with ajax requests
- WordPress comment submit button substitutes/options
- WordPress Ajax Always returning 0
- Using data sent via AJAX in multiple functions on a WP plugin
- Problem with AJAX in wordpress plugin
- load ajax using admin-ajax.php
- Ajax button not working
- How to keep track of when a vote is cast?
- WordPress plugin admin page – using WordPress function in linked php file
- Load Posts on Click via Ajax into a DIV
- set post limit at load more ajax wordpress
- Use value from Ajax call in PHP function
- Woocommerce with Lazy Load php and ajax
- How to deal with too many $_POST variable conditions from ajax request at backend? [closed]
- How to remap one of the TinyMCE Advanced Editor button to open the wordpress media library?
- Simple AJAX notification when the new post is added to the database
- AJAX wp_insert_user WORKS but responds with “The site is not enabled”
- Short code template + ajax
- Ajax filter button display all posts
- Can I make get_users() query global?
- Compare $_POST returned values with term array
- Is it possible to create new user from external form using REST API?
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- WordPress REST API register_rest_route give a 500 error
- How to use AJAX to call php page with parameter
- Get related product based on subcategory selected from category id with ID 142
- A $_POST should occur when submit form but is not?
- When echo follow Ajax button inside Ajax pagination template not working?
- My jQuery Ajax form submit is still refreshing page?
- jQuery Ajax PHP function call returning [object Object]
- admin-ajax GET response bad request
- 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?
- Calling PHP Scripts in Ajax that are in PHP Snippets
- javascript variable to wordpress php variable
- Post not populating for custom post type based on category selection
- SOAP Request/Parsing XML From wp_send_json_success
- Output votes to div dynamically in wordpress
- Get uploaded image and attach it to the new post
- Admin-ajax php not working on new wordpress version
- Retrieve Json data and create multiple pages with it
- Submitting a form, using Ajax, to run a SQL Select query based on user input from the form
- WP_Query with AJAX returning empty array
- Incrementing PHP variable onclick to display posts by month
- Proper way to use WordPress function with AJAX PHP file
- Errors being created by admin-ajax.php
- Loading Posts & Category with Ajax
- How to use AJAX in WordPress in MYSQL query?
- Simple jQuery AJAX Request fails to run PHP Script
- Convert canvas to image and upload image to server
- How to get post category list as select in front-end?
- Live search from database table
- Processing ajax call to php to insert into mysql database
- PHP Warning: Missing argument 2
- Allow user to Upload image and manipulate it on the frontend
- Is there a hack for using is_page() within the function.php file?
- 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
- How to SELECT number from table and use in calculation . Unsupported operand types
- Execute Jquery when a specific page in my plugin is loading
- PHP: How to access db the right way in plugin?
- calling admin-ajax.php from admin-ajax.php
- Submit form to db
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- AJAX function not working [closed]
- what does $options = get_option(‘test_theme’); do?
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- How to load previous or next attachment with jquery ?
- Can not call .php files after switching to %postname%
- How to split AJAX response into two divs
- How to set variables with AJAX request to use in another function in WordPress
- Search Ajax Call – Use Form Data in Response
- WordPress Conditional / Multiple Taxonomy Query
- Validating an email input from form field before submit using JQuery, AJAX, and PHP