Advertisement
Guest User

Untitled

a guest
Feb 27th, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ajaxize javascript function - calls ajaxize_this on the server for the div */
  2. jQuery(document).ready( function($) {
  3.     $('div[id^="ajaxize_this"]').each( function() {
  4.         $(this).ajaxError(function(e, xhr, settings, exception) {
  5.             // checking that this is a 404 page in which we want to use ajaxize
  6.             // (as opposed to an error with ajaxize response itself)
  7.             // and that the response is not empty
  8.             if (ajaxizeParams.is_404 && settings.url.indexOf(escape($(this)[0].id))>0) {
  9.                 $(this)[0].innerHTML = xhr.responseText;
  10.             }
  11.         });
  12.         var newquery = $.query.set('ajaxize_this', $(this).attr('id')).set('_wpnonce', ajaxizeParams._wpnonce);
  13.         $(this).load('http://' + window.location.hostname + newquery, function() {
  14.             // renaming div id to prevent loops
  15.             $(this).attr('id', 'loaded_' + $(this).attr('id'));
  16.         });
  17.     });
  18.     return false;
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement