- EcommerceApplication.zip
- EcommerceApplication
- EcommerceApplication.sln
- EcommerceApplication.suo
- EcommerceApplication
- App_Data
- Products.mdf
- Products_log.LDF
- bin
- EcommerceApplication.dll
- EcommerceApplication.pdb
- EntityFramework.dll
- EntityFramework.xml
- Microsoft.Web.Infrastructure.dll
- Microsoft.Web.Optimization.dll
- System.Web.Helpers.dll
- System.Web.Mvc.dll
- System.Web.Providers.dll
- System.Web.Razor.dll
- System.Web.WebPages.Deployment.dll
- System.Web.WebPages.dll
- System.Web.WebPages.Razor.dll
- Content
- Controllers
- DataAccess
- EcommerceApplication.csproj
- EcommerceApplication.csproj.user
- Global.asax
- Global.asax.cs
- Images
- 1.jpg
- 10.jpg
- 2.jpg
- 3.jpg
- 4.jpg
- 5.jpg
- 6.jpg
- 7.jpg
- 8.jpg
- 9.jpg
- accent.png
- aspNetHome.png
- bullet.png
- facebook.png
- findHosting.png
- heroAccent.png
- NuGetGallery.png
- orderedListOne.png
- orderedListThree.png
- orderedListTwo.png
- twitter.png
- windowsLive.png
- Models
- packages.config
- Properties
- Scripts
- Views
- Web.config
- Web.Debug.config
- Web.Release.config
- packages
- AspNetMvc.4.0.10906.0
- AspNetMvc.4.0.10906.0.nupkg
- lib
- net40
- System.Web.Mvc.dll
- AspNetWebPagesCore.2.0.10906.0
- lib
- Cart.zip
- MvcApplication3.zip
|
/// <reference path="jquery-1.6.2.js" />
/// <reference path="jquery.validate.js" />
$(function () {
// Cache for dialogs
var dialogs = {};
var getValidationSummaryErrors = function ($form) {
// We verify if we created it beforehand
var errorSummary = $form.data('validation-summary-errors');
if (!errorSummary) {
errorSummary = $('<div class="validation-summary-errors"><span>Please correct the errors and try again.</span><ul></ul></div>')
.insertBefore($form);
// Remember that we created it
$form.data('validation-summary-errors', errorSummary);
}
return errorSummary;
};
var formSubmitHandler = function (e) {
var $form = $(this);
// We check if jQuery.validator exists on the form
if (!$form.valid || $form.valid()) {
$.post($form.attr('action'), $form.serializeArray())
.done(function (json) {
json = json || {};
// In case of success, we redirect to the provided URL or the same page.
if (json.success) {
location = json.redirect || location.href;
} else if (json.errors) {
var errorSummary = getValidationSummaryErrors($form);
var items = $.map(json.errors, function (error) {
return '<li>' + error + '</li>';
}).join('');
var ul = errorSummary
.find('ul')
.empty()
.append(items);
}
});
}
// Prevent the normal behavior since we opened the dialog
e.preventDefault();
};
var loadAndShowDialog = function (id, link, url) {
var separator = url.indexOf('?') >= 0 ? '&' : '?';
// Save an empty jQuery in our cache for now.
dialogs[id] = $();
// Load the dialog with the content=1 QueryString in order to get a PartialView
$.get(url + separator + 'content=1')
.done(function (content) {
dialogs[id] = $('<div class="modal-popup">' + content + '</div>')
.hide() // Hide the dialog for now so we prevent flicker
.appendTo(document.body)
.filter('div') // Filter for the div tag only, script tags could surface
.dialog({ // Create the jQuery UI dialog
title: link.data('dialog-title'),
modal: true,
resizable: true,
draggable: true,
width: link.data('dialog-width') || 300
})
.find('form') // Attach logic on forms
.submit(formSubmitHandler)
.end();
});
};
// List of link ids to have an ajax dialog
var links = ['logonLink', 'registerLink'];
$.each(links, function (i, id) {
$('#' + id).click(function (e) {
var link = $(this),
url = link.attr('href');
if (!dialogs[id]) {
loadAndShowDialog(id, link, url);
} else {
dialogs[id].dialog('open');
}
// Prevent the normal behavior since we use a dialog
e.preventDefault();
});
});
});
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have been working as a Software Engineer on Microsoft .NET Technology.I have developed several web/desktop application build on .NET technology .My point of interest is Web Development,Desktop Development,Ajax,Json,Jquey,XML etc.I have completed Master of Computer Application in May-2011.I'm not happy unless I'm learning something new.