1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Passing data back and forth to overlays

Discussion in 'XenForo Development Discussions' started by Neuro, Aug 11, 2014.

  1. Neuro

    Neuro Member

    I'm having a tough time trying to incorporate a jquery/ajax tree for adding nodes to a geneology tree, using the code found here:


    I've already dug through all the tutorials, including the ajax and jquery ones (great tutorials by the way). I have many questions, but here is one that I am currently stuck on:

    Is there a way to send and receive data from a overlay form that isn't called using "class=OverlayTrigger" ? The code I'm using is calling an overlay using something like:

    $('.'+class_name+'. span.add_action').live('click', function() {... call overlay ... });
    The code registers a click event on a <span> object and brings up my overlay form (with minor issues), but I'm unsure of how to deal with sending data to that overlay form and receiving it back; without doing all of this through Xenforo.register and the <a href ... class=OverlayTrigger>. I want to be able to send some default information (like the name, age date, etc), from the list (<li>) element that the <span class=add_action> is attached to, and have them modify it, and then send it back to update the geneology tree.

    The reason why I'm trying to approach this problem this way, is that I would rather not have to re-write all of the code associated with drawing the tree. I'm not even sure if I'm capable of doing that.
  2. tyteen4a03

    tyteen4a03 Well-Known Member

    (.live() is deprecated; don't use it.)
  3. Neuro

    Neuro Member

    Thanks! Then assuming I'm going to be using .on() instead ...
  4. Neuro

    Neuro Member

    Ok, I've found out that I can pass data to the eventhandler in .on():


    .. which will allow me to pass data to a handler. I guess I can pass that data to whatever handler that calls Xenforo.ajax. won't know until i test it tonight. what about the info going the other way?

Share This Page