I'm not sure how to post this question, not including half the code of my site, but here.
I have a website with a subcontract form, company form and contact form. From the subcontract form, you can create a new company and / or a new contact using the buttons that open the jQuery dialogs and publish the company or contact information. The company form has a button for creating a new contact.
From the form of subcontract:
$('#popupCreateCompany').dialog(
{
autoOpen: false,
modal: true,
width: 600,
open: function(event, ui) {
if ($('#primary_company').val().length > 0) {
$('#secondary').attr('checked', 'true');
}
else {
$('#primary').attr('checked', 'true');
$('#sec').hide();
}
},
buttons:
{
'Add': function() {
var dialog = $(this);
var form = dialog.find('input:text, select');
$.post('<%= ResolveUrl("~/company/post") %>', $(form).serialize(), function(data) {
if (data.Result == "success") { ...
.
$('#popupCreateContact').dialog(
{
autoOpen: false,
modal: true,
width: 600,
buttons:
{
'Add': function() {
var dialog = $(this);
var form = dialog.find('input:text, select');
$.post('<%= ResolveUrl("~/contact/post") %>', $(form).serialize(), function(data) { ...
From the company form:
$('#popupCreateContact').dialog(
{
autoOpen: false,
modal: true,
buttons:
{
'Add': function() {
var dialog = $(this);
var form = dialog.find('input:text, select');
$.post('<%= ResolveUrl("~/contact/post") %>', $(form).serialize(), function(data) {
if (data.Result == "success") { ...
, - . , . . "", . $.post, , . /, . , .
:
[AcceptVerbs(HttpVerbs.Post), MarlowAuthorize(Roles = "Subcontract_Modify, Admin", ViewName = "AuthorizationError")]
public JsonResult Post(company company)
{
if (ModelState.IsValid)
{
try
{
. , - . :
[AcceptVerbs(HttpVerbs.Post), MarlowAuthorize(Roles = "Subcontract_Modify, Admin", ViewName = "AuthorizationError")]
public JsonResult Post(contact contact)
{
if (ModelState.IsValid)
{
try
{
, . , . , . . , , , , , .
Firefox, Firebug, , Firefox. IE7 IE8.