Transfert of an array on js on post

please help
i don’t understand why my post dont work

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Document sans nom</title>
    <script src=""></script>
            <form method="post">
                <table  border="0">
                            <select name="drop1" id="lstBox1" size="4" style="width:100%;height : 200px">
                                <option value="first">first option</option>
                                <option value="second">sec option</option>
                                <option value="third">third option</option>
                                <option value="fourth">fourth option</option>
                                <option value="fifth">fifth option</option>
                                <option value="sixth">six option</option>

                            <input type="button" id="add" value=">>" style="display:block;" />
                <table id="myTable" border="1">

                <input type="button" value="ok" id="ok" /></form>
            <br />
            <script type="text/javascript">
                $(document).ready(function() {
                    $('#add').click(function(e) {
                        var selectedOpts = $('#lstBox1 option:selected').val();
                        var selectedOpts1 = $('#lstBox1 option:selected').text();
                        if (selectedOpts.length == 0) {
                            alert("Nothing to move.");

                        document.getElementById("myTable").insertRow(-1).innerHTML = "<td class='prdt'>" + selectedOpts1 + "</td><td class='qt'><input type='number' class='quantite'></td>";
                        $('#lstBox1 option:selected').remove();
                    $('#ok').click(function(e) {
                        var table = $('#myTable tr');
                        var trCount = table.length;  //count tr
                        var a = [];

                        $('#myTable td ').each(function() {
                            //  var tdID=$(this).attr('id'); //get id
                            var tdcontent = $(this).text(); //get content
                            // var quantite=document.getElementById("quantite").value;
                            var quantite = $(this).parent().find('.quantite').val()
                            // alert('id='+tdID);
                            //  alert('content='+tdcontent);

                        // var st = JSON.stringify(a);
                        //var dataString = 'a='+ a;
                        //var produit = "sss";

                            type: 'POST',
                            url: 'test2.php',
                            data: { name: "John", location: "Boston" },
                                    function() {
                           error: function() { alert("erreur"); }



Welcome to the forums :slight_smile:

The first thing that I notice is that you have two <html> and two <body> tags.

Try fixing the markup and see if that helps.

It doesn’t work

this one also i don’t know what :cry:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" dir="ltr" lang="en-US">
    <head profile="">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>jQuery AJAX arrays</title>
        <script type="text/javascript" src=""></script>
        <script type="text/javascript">
                sendAjax = function(){
    var data = {
                  foo:  123,
                  bar:  456,
                  'rows[0][column1]':    'hello',
                  'rows[0][column2]':    'hola',
                  'rows[0][column3]':    'bonjour',
                  'rows[1][column1]':    'goodbye',
                  'rows[1][column2]':    'hasta luego',
                  'rows[1][column3]':    'au revoir',
                  'test1[test2][test3]': 'baz'
            type:           'post',
            cache:          false,
            url:            'test2.php',
            data:           data,
			success: function (data) {
    //function to handle the response
        <input type="button" style="width: 130px; height: 60px" value="send AJAX" onclick="sendAjax();" />

Do you see any errors in your browser’s console?