Using jQuery, how do you mimic the form serialization for a select with multiple options selected in

Posted by CarolinaJay65 on Stack Overflow See other posts from Stack Overflow or by CarolinaJay65
Published on 2008-10-12T03:31:57Z Indexed on 2010/06/09 5:02 UTC
Read the original article Hit count: 139

Filed under:

Below is my $.ajax call, how do I put a selects (multiple) selected values in the data section?

$.ajax({
	type: "post",
	url: "http://myServer" ,
	dataType: "text",
	data: {
		'service' : 'myService',
		'program' : 'myProgram',
		'start' : start,
		'end' : end ,
		},
	success: function(request) {
	  result.innerHTML = request ;
	}	// End success
  }); // End ajax method

EDIT I should have included that I understand how to loop through the selects selected options with this code:

$('#userid option').each(function(i) {
 if (this.selected == true) {

but how do I fit that into my data: section?

© Stack Overflow or respective owner

Related posts about jQuery