dom manipulation - Moving around jquery ajax loaded content to be reusable -


I have several links that point to a single AJAX URL. I can load it for each request in a single #DIV with the pattern: Load and remove for each link Now whenever I need a URL, I delete and request again I am trying to avoid the process.

I have two scenarios, still need inquiries and badly suggesting them:

  1. create separate containers #DIVS so that they can detect this in each DIV Can not fight while loading a URL and go ahead (without destructive / removal) without hiding and showing regularly. This means that each link request loads the same AJAX in one container and the same AJAX in each container. #Type is very tedious, because each link once loads AJAX.

  2. Create a single #DIV and go ahead this is # DIV (the same class containing, .jax-container).

So what I'm trying to achieve is a reusable and efficient code. Any suggestions and examples will be highly appreciated

UPDATE, what has been done to clarify my question:

  $ ('a.browse'). Click (function () {var t = $ (this); T. Show (); T (P) (). ('Input' tx) FindClass ('focus'); // @TODO, Avoid using the Remove (), and move it instead of using the same content $ ('# imgPicker, # closebox') instead of another .hasPicker class, instead of $ ('. Picker-on') After 'RemoveClass' (' picker-on '); t.parent () .prev (). (' Input.tex '). (' & Lt; div id = "imgPicker" & gt; & lt; / div & Gt; '). Parents (.) AddClass (' picker-on '); // @TODO, check that # tabs have been loaded elsewhere, and try to add it to the current link Please call the person who calls it if ($ ('$ tab'). Length) {t.parent (.). ('#imgPicker') .Andand ('# tab');} Other {t Parent (.). DoAjax (); // same load jax content} t.hide (); description is false;}); $ ('Input.tex'). Rap ('' 
';);

And doAjax () stuff here:

  $ .fn.doAjax = function () {return.Each (function () Check the request and cancel it if (re) req.abort (); // showloading (); req = $ .ajax ({url: "? Ajax = 1", method: 'GET', cache: true '& Lt; span id = "closebox" & gt; & lt; / span & gt;'); $ ('# ("# tab"). $ ("# Tab"). Tab (); // reset Request req = null;}, error: function () {warning ('failed to load image collection.');}});})}}  

Notes: #imgPicker There is a dynamic container for #tabs; I was a ui.dialog, but seeing the size I just got it a simple Completed with custom popup status and requested link and form. DoAjax () is handled separately as a single request for loading the same content (#tabs). Input.tex TextFile Form (Where all items / options can be stored in the # tab.) After the link, request the same AJAX content through the same AJAX URL.

Hope I can do my Clean you

Thanks

You can try the new release Jquery 1.4 I do not know That's what you are trying to say, but I can see that you can use the .detach () function in JPeyer 1.4. It temporarily removes the data from the DOM and you can use it again. Hope it helps.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -