Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.fn.orderWindows = function()
- {
- return this.each(function()
- {
- var $a = $(this);
- $a.bind("click", function(e)
- {
- e.preventDefault();
- $.get($a.attr("href"), function (a)
- {
- var $modal = $(a).clone();
- $("body").append($modal);
- $modal.on("hidden.bs.modal", function()
- {
- $modal.remove();
- })
- $modal.find("[name='phone']").mask("+7 (999) 999-99-99");
- $modal.find("form").on("submit", function (e)
- {
- e.preventDefault();
- var $form = $(this), $req = $form.find("[required='required']").filter(function ()
- {
- return !$(this).val().length;
- });
- if ($req.length)
- {
- $req.first().focus();
- return false;
- }
- var post = $.post($form.attr("action"), $form.serializeArray(), function (a)
- {
- $modal.find("form").html(a);
- $modal.find(":submit").hide();
- });
- });
- $modal.modal("show");
- });
- });
- })
- }
- if($(".staff-order").length)
- {
- $(".staff-order").orderWindows();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement