0

I have a form I am submitting via jquery ajax. Early in the form, I have this field:

 <select name="inquirymodule[]" id="inquirymodule">

The user can add as many as they like, and all the selects go into the inquirymodule[] array.

The jQuery looks like this:

 jQuery.ajax({
         type: 'POST',
         url: 'ajax.php',
         dataType: 'json',
         data: {
                inquirymodule: jQuery("select[name='inquirymodule[]']").serialize(),
         },
         error: function(XMLHttpRequest, textStatus, errorThrown) {
             alert('error');
         }
 });

That works fine.

Trying to do the same thing with a date, like this:

 <input class="formInput" type="text" id="startBreak0" name='startbreak[]' />

adding

 startbreak: jQuery("select[name='startbreak[]']").serialize()

to the ajax call. It doesn't work, I cannot see why. Suggestions?

1 Answer 1

1

You still have select in the selector, when the elements are inputs

startbreak: jQuery("input[name='startbreak[]']").serialize()
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.