0

I'm getting a json string with jQuery and then for each value, I add a checkbox.

function dateClick(url){
$.getJSON(url,
    function(data){

        var row = $("#HourSelectionTable tbody").html();
        $("#HourSelectionTable").empty();
        $("#HourSelectionTable").append(row);

        $.each(data, function(i,data){
            if(data.free == 'true'){
                $("<tr><td><input id='"+data.date+"-"+data.hour+"' value='"+data.date+"-"+data.hour+"'type='checkbox' onclick='hourClick(this.id);' /></td><td>"+data.hour+"</td></tr>").appendTo("#HourSelectionTable");                    
            }else {
                $("<tr><td>&nbsp;</td><td>"+data.hour+"</td></tr>").appendTo("#HourSelectionTable");                    
            }

            if ($("#HourSelectionTable").is(":hidden")) {
                $("#HourSelectionTable").slideDown("slow");
            }

        });
    });

}

Now, when I post the form and look at $_POST, there is nothing there.

echo ("<pre>");
print_r($_POST);
echo ("</pre>");

Gives:

Array
(
    [Submit] => Bevestig
)

How can I solve this?

Dennis

1 Answer 1

1

Your form is empty because you're not giving the input fields the name attribute. The name attribute is what populates the POST HTTP request and then the $_POST array.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.