This code works on one of my dev boxes (using JQ v1.3.2.) I just updated to the latest JQ version and it no longer works. I notice when looking at the form data being submitted by Chrome, I’m passing “MessageID[]” which explains why my function is complaining about missing messageIDs. Can someone put me out of my misery and tell me how I can fix? (urg, sorry… i know this is something is should know.)
Thx as always.
<input type="checkbox" name="message" value="#messageID#" />
$('.move').click(function(e){
var folderID = $(this).attr('data-id');
var selected = new Array();
$("input:checkbox[name=message]:checked").each(function() {
selected.push($(this).val());
});
$.post(
<cfoutput>"My.cfc?method=moveMessage&ID=123&time=#now()#", </cfoutput>
{folderID: folderID, messageID: selected },
function() {
loadMessages();
});
return false;
alert('Please select at least one message.')
});
I think you want the “traditional” form of parameter serialization (which won’t include the
[]). To get this option, you’re going to have to convert your$.postinto a$.ajaxcall:You can also set this property globally as specified in the documentation for
serialize: