0

Is it possible to pass the value of an HTML table through post or not? I'm making a PDF report, and want to get only in my HTML table.

karel
  • 5,489
  • 46
  • 45
  • 50

2 Answers2

0

Yes use textarea for submitting html content

0

sure, just create a valid form and send the content ..

<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    </head>
    <body>
        <form id="f">
            <input type="hidden" name="mytable" />
            <button>Submit</button>

        </form>

        <table id="t">
            <tr>
                <td>ra ra</td>

            </tr>

        </table>

    </body>

    <script>
    $(document).ready( function() {
        $('#f').on( 'submit', function( e) {
            let t = $('#t');

            $('input[name="mytable"]', this).val( t[0].outerHTML)
            console.log( $(this).serializeArray());

            return false;

        });

    });
    </script>

</html>
David Bray
  • 566
  • 1
  • 3
  • 15