Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function(){
- // vhodně nastylovaný div vložím po načtení stránky
- $('<div id="ajax-spinner"></div>').appendTo("body").ajaxStop(function () {
- // a při události ajaxStop spinner schovám a nastavím mu původní pozici
- $(this).hide().css({
- position: "fixed",
- left: "50%",
- top: "50%"
- });
- }).hide();
- // zajaxovatění odkazů
- $("a.ajax").live("click", function (event) {
- event.preventDefault();
- $.get(this.href, $.nette.success);
- // zobrazení spinneru a nastavení jeho pozice
- $("#ajax-spinner").show();
- });
- // ajaxové formuláře
- $(function () {
- // odeslání na formulářích
- $('body').delegate("form.ajax", "submit", function (e) {
- if (!Nette.validateForm(this)) {
- return false;
- }
- $(this).ajaxSubmit(e, {
- success : $.nette.success
- });
- }).delegate("form.ajax :submit", "click", function (e) {
- e = e || event;
- var target = e.target || e.srcElement;
- this['nette-submittedBy'] = (target.type in {submit:1, image:1}) ? target : null;
- if (!Nette.validateForm(this.form)) {
- return false;
- }
- $(this).ajaxSubmit(e, {
- success : $.nette.success
- });
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment