Pass array through jQuery

Hi Guys!

I have a contact form that uses jQuery. What I need is a way of passing an array through jQuery. The form can be found here:

As you can see, I have form arrays setup (the two sets of checkboxes). What I basically need to do is pass this info through jQuery. I can do the rest using PHP.

The jQuery function I am using is here:

		var action = $(this).attr('action');
		$('#contactform #submit').attr('disabled','disabled');
		$("#message").slideUp(450,function() {
		$.post(action, { 
			mode: $('#mode').val(),
			your_name: $('#your_name').val(),
			tel: $('#tel').val(),
			email: $('#email').val(),
			helpwith: $('#helpwith').val(),
			besttime: $('#besttime').val(),
			comments: $('#comments').val(),
				document.getElementById('message').innerHTML = data;
				$('#contactform #submit').attr('disabled',''); 
				if(data.match('success') != null) $('#contactform').slideUp('slow');
		return false; 

Any ideas?


The main problem is that you’re trying to do everything with identifiers. Did you know that identifiers must be unique?

Here is how you post your form.
You place a form tag around the contents of your form, then you serialize the contents and post it.

$.post(action, $("#contactform").serialize(),
    function (data) {

You will need to fix up the structure of your HTML code though. Currently web browsers are ignoring your form tag because its start and end tags don’t properly enclose all of their contents. As a result, undefined behaviour occurs in web browser with your form tag. Some might ignore it completely, whereas others might try and interpret things in a different way.

Thanks for your reply.

Unfortunately, I don’t have a clue when it comes to Javascript/jQuery (i’m a PHP developer). Would you be able to fix this up for me (paid of course)?

Thanks in advance.

Yes, I’ll do what I can to help.