0

I have a link with javascript onclick function that gets html code from current page say a.php sends to javascript file script.js to edit it and now should go to destination php file print_invoice.php.

I have successfully sent data from php to javascript file and edited the data. Now i want to send to print_invoice.php. See my code below:

a.php

 <td><a id="getinfo"  href="print_invoice.php?invoice_id='.$invoiceDetails["order_id"].'"    onclick="invoice_ajax('.count(getInvoiceItems($invoiceDetails["order_id"])).')"  data-info="'.base64_encode($template).'" title="Print Invoice"><span class="glyphicon glyphicon-print"></span></a></td>

script.js

var data = 'targetData';
     
    var variableToSend = 'foo';
$.post('print_invoice.php', {variable: variableToSend});

print_invoice.php

$variable = $_POST['variable'];

 echo $variable;
Landry
  • 21
  • 2
  • It looks like *script.js* and *print_invoice.php* do that (although you've no code to inspect the result so you'd need to look at the Network tab in your browser's developer tools to prove it works). What's the problem? (Please read [ask]). – Quentin Dec 12 '22 at 16:14
  • 1
    (I don't think the duplicate question is a *good* duplicate since it basically says to do what you're already doing; but your question lacks enough detail to give a real answer to so the question should remain closed for the time being). – Quentin Dec 12 '22 at 16:16

0 Answers0