var $dlg = $("#add-edit-dialog").dialog({
autoOpen: false,
show: "blind",
closeOnEscape: true,
resizable: true,
width: 1200,
height: 750,
minHeight: 600,
minWidth: 950,
buttons: {
"Save": function () {
if ($("#add-edit-form").valid()) {
var urlLoc = '/Client/Edit/' + currentId;
if ($('#fntype').val() === "Add")
urlLoc = '/Client/Add';
var oForm = $("#add-edit-form").serialize();
oForm = oForm.concat($('#frmClientsSearch').serialize());
$.ajax({
type: 'POST',
url: urlLoc,
dataType: 'json',
data: oForm,
contentType: 'application/json',
success: function (result) {
$('#flexClients').flexAddData(result);
}
});
$(this).dialog('close');
} else return false;
},
Cancel: function () {
$(this).dialog("close");
clearForm();
if (validator)
validator.resetForm();
}
},
close: function () { clearForm(); },
open: function () {
}
});
<head> <title>Invalid JSON primitive: fntype.</title> <meta name="viewport" content="width=device-width" /> <style>
So, the problem is with fnType. Do you see what I am missing and is there a way to exclude the fntype from serialize() (I don't really need it, I think)?
oForm variable is this:
|
|
"fntype=&ClientId=142&ClientNumber=6420&ClientName=Adventure+Sports+Cntr&Client.Address=tr&Client.Contact1.Contact=&Client.Contact1.Email=&Client.Contact1.phoneInfo.Phone=&Client.Contact1.phoneInfo.Ext=&Client.Contact2.Contact=&Client.Contact2.Email=&Client.Contact2.phoneInfo.Phone=&Client.Contact2.phoneInfo.Ext=searchClientNo=&searchClientName=a" |