var data = $(this).attr('data-json') in php
- User
var data = $(this).attr('data-json') in php
- Assistant
To work with a
data-jsonattribute that you obtain via jQuery in a PHP context, you'll typically need to pass this data from JavaScript to PHP. This is usually done when making an AJAX request, submitting a form, or navigating to a new page with data in a query string or POST request. Below are a few ways you might pass this data from client-side JavaScript (using jQuery) to your server-side PHP script.