I have links with the class name 'jLink' that update

After each AJAX Call I re-run a function named init (which is initially
called via document ready)

It does work but after two sometimes three clicks it stop working any ideas?

this is the unbind / bind is inside that init function

function init()
{

....
      if(siteOptions.page.isInit)          {
       siteOptions.page.isInit = true;
           $("a.jLink")
                   .unbind('click')
                   .bind(
                       'click',
                       {href: this.href},
                       function(event)
                       {
                           event.stopPropagation ();
                           event.preventDefault();
                           jLinkCall(this.href);
                       }
                   );

      }
....

}

function jLinkCall(jHref)
{
var regex =
'^(.*)\/([a-zA-Z0-9]*)\/([a-zA-Z]*)\/([a-zA-Z]*)\/([0-9]*)([\/]*)([0-9]*)([\/]*)$';
var viewURL = new String(jHref), dataURL = "", params = {}, re = new
RegExp(regex, "g"), dataURL = "";
var m = re.exec(viewURL);
if (m !== null) {
   dataURL = m[1] + '/' + m[2] + '/' + m[3] + '/' + m[4] + '/' + m[5] + '/'
+ ((m[7]) ? m[7]: 1) + '/data/';
}
$("div#main").SlideInUp(
       500,
       function()    {},
       'easein'
   ).empty();

   $.getJSON(
           dataURL,
           function(json) {
               $("#main").html("<div id=\"innerMain\">" + json.data +
"</div>");
               $('#top').ScrollTo(800, 'easeout');
               $('div#main').SlideOutDown(500, function() {
                       jLinkComplete();
                   },
               'easeout');
       }
   ); // /getJSON
} // jLinkCall()


function jLinkComplete()
{
   siteOptions.page.isInit = false;
   init();
}   //   jLinkComplete()
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to