Advertisement
Guest User

Untitled

a guest
Aug 4th, 2011
83
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.             if (xhr.responseText) {
  6.                 $(this)[0].innerHTML = xhr.responseText;
  7.             }  
  8.         });
  9.         var newquery = $.query.set('ajaxize_this', $(this).attr('id')).set('_wpnonce', ajaxizeParams._wpnonce);
  10.  
  11.         $(this).load(location.pathname + newquery, function() {
  12.             // renaming div id to prevent loops
  13.             $(this).attr('id', 'loaded_' + $(this).attr('id'));
  14.         });
  15.     });
  16.     return false;
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement