I have an associative array and I'm trying to pass it to the parameters section of the jquery load method. However it is not showing up as a post on the server side. How can I accomplish this?
Here is my code:
var selectcustomerpopup = null;
$(document).ready(function() {
// Find customer
$('.CustomerSelectBtn').click(function() {
var uniqueid = $(this).attr('id');
var customerSelectURL = $('#ajax_customer_select_url').val()
+ "/" + uniqueid;
var custselectdata = new Array();
custselectdata["fname"] = "TestFirst";
custselectdata["lname"] = "TestLast";
if (! ($('#selectCustomerDialog').length)) {
$('body').append(
$('<div id="selectCustomerDialog" style="display: none;"></div>')
);
}
var $findCustomerDialog =
$('#selectCustomerDialog').load
(customerSelectURL, custselectdata)
.dialog({
autoOpen: false,
title: 'Select Customer',
width: 630,
height: 450,
position: 'center',
resizeable: true,
modal: true,
draggable: true,
closeOnEscape: true,
closeText: 'close'
});
$findCustomerDialog.dialog('open');
selectcustomerpopup = $findCustomerDialog;
return false;
});
} );
Additional Info: I got a good answer, but I did some more research and found a great link explaining associative arrays in javascript very well: http://blog.xkoder.com/2008/07/10/javascript-associative-arrays-demystified/
custselectdataarray with an object:var custselectdata = {};