Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Here's the element I'm grabbing from
- <a href="#" id="clickable" date="<?php echo htmlentities(json_encode($dateArray)) ?>" customer="<?php echo htmlentities(json_encode($customerArrayClean)) ?>">
- <i class="far fa-plus-square fa-2x"></i>
- </a>
- // Here's the AJAX call
- <script>
- $(document).ready(function()
- {
- $("#clickable").click(function (e)
- {
- e.preventDefault();
- let date = $("#clickable").attr("date");
- let customer = $("#clickable").attr("customer");
- console.log(date); // OUTPUT -- ["2019-12-15","2020-01-15"]
- console.log(customer); // OUTPUT -- ["CUSTOMER 1","CUSTOMER 2","CUSTOMER 3","CUSTOMER 4"]
- $.ajax
- ({
- type: "POST",
- url: "./reconciler_process_customers_testing.php",
- data: {
- date: date,
- customer: customer
- },
- success: function(html)
- {
- if (html.success == true) {
- alert("WORKED");
- }
- },
- error: function()
- {
- alert("DIDNT WORK...YET");
- }
- });
- });
- });
- </script>
- // Here's the arrays being decoded
- $dateArray = json_decode($_POST['date'], true);
- $customerArray = json_decode($_POST['customer'], true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement