2

I have the following snippet.

    var myData = {
    video: $("input[name='video[]']:checked").serialize(),
    sinopse: $("#sinopse").val(),
    dia: $("#dia").val(),
    quem: $("#quem").val()
};

jQuery.ajax({
            type: "POST", // HTTP method POST or GET
            url: "response.php", //Where to make Ajax calls
            dataType:"text", // Data type, HTML, json etc.
            data:myData, //Form variables
            success:function(response){
                $("#responds").append(response);
                $(".video").val(''); //empty text field on successful
                $("#sinopse").val('');
                $("#dia").val('');
                $("#quem").val('');
                $("#FormSubmit").show(); //show submit button
                $("#LoadingImage").hide(); //hide loading image

            },

all variables except "video" are getting saved in database. What can be wrong here? (maybe the problem is with jquery)

1
  • There's an extra comma at the end of your code, and you're missing a ); as well. (Unless there's more code that should come afterwards?) Commented Jan 1, 2016 at 9:15

1 Answer 1

1

refer this link:- serialize

You can get selected checkboxes values by

$("input[type='checkbox']:checked").serialize();
Sign up to request clarification or add additional context in comments.

Comments