Here i am in a situtation where i am trying to add the dynamic tabs to the existing tabs but also if that link or popup is agai opened, i am trying to make sure it does not duplicate the tabs, my current code is doing as such as of now
Here is my html and my jquery code
Код: Выделить всё
function loadbtns(dataAttributes) { $.ajax({ url: "x.cfm?section=11", type: 'POST', data: dataAttributes, dataType: 'json', success: function(response) { console.log(response); if(Object.keys(response).length > 0) { $('#tabs').find("li.addedDynamic").each(function() { $(this).remove(); }); var tabTitle1 = response.title1; // replace with how you access your title in data var tabContent1 = response.msg1 + "\n" + response.label1 + "\n" + response.textData1 + "\n" + response.content1; // replace with how you access your content in data var tabTitle2 = response.title2;// replace with how you access your title in data var tabContent2 = response.msg2 + "\n" + response.label2 + "\n" + response.textData2 + "\n" + response.content2; // replace with how you access your content in data var tabTemplate = "[*][url=#{href}]#{label}[/url]"; var id1 = "tabs-" + ( $("#tabs li").length + 1 ); var id2 = "tabs-" + ( $("#tabs li").length + 2 ); var li1 = $( tabTemplate.replace( /#\{href\}/g, "#" + id1 ).replace( /#\{label\}/g, tabTitle1 ) ); var li2 = $( tabTemplate.replace( /#\{href\}/g, "#" + id2 ).replace( /#\{label\}/g, tabTitle2 ) ); $("#tabs").find( ".ui-tabs-nav" ).append( li1 ); $("#tabs").append( "" + tabContent1 + "" ); $("#tabs").find( ".ui-tabs-nav" ).append( li2 ); $("#tabs").append( "" + tabContent2 + "" ); $("#tabs").tabs( "refresh" ); } } }); }
Код: Выделить всё
[list] [*][url=#newMgrAprvlScreen][/url] [*][url=#commentsSectionData][/url] [/list]
Код: Выделить всё
{ "textData1": "", "msg1": " accepted and email sent successfully!", "textData2": "", "msg2": "request has been sent!", "title2": "Request", "title1": "Accepted", "content2": "", "content1": "", "label2": "Request", "label1": "Accepted " }
Источник: https://stackoverflow.com/questions/781 ... ally-added