tag-it icon indicating copy to clipboard operation
tag-it copied to clipboard

how to make data of json dynamically ?

Open MohammadaliMirhamed opened this issue 8 years ago • 2 comments

Hello Buddy . Thank You For This Plugin . I want change Data json dynamically ? how can i get that ?

I changed Code to the below

function showHint(str) {
    if (str.length == 0) { 
        document.getElementById("txtHint").innerHTML = "";
        return;
    } else {
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.onreadystatechange = function() {
            if (this.readyState == 4 && this.status == 200) {

               var sampleTags = JSON.parse(this.responseText);

                $(function(){

            $('#myTags').tagit();

            $('#singleFieldTags2').tagit({
                availableTags: sampleTags
            });


            eventTags.tagit({
                availableTags: sampleTags,
                beforeTagAdded: function(evt, ui) {
                    if (!ui.duringInitialization) {
                        addEvent('beforeTagAdded: ' + eventTags.tagit('tagLabel', ui.tag));
                    }
                },
                afterTagAdded: function(evt, ui) {
                    if (!ui.duringInitialization) {
                        addEvent('afterTagAdded: ' + eventTags.tagit('tagLabel', ui.tag));
                    }
                },
                beforeTagRemoved: function(evt, ui) {
                    addEvent('beforeTagRemoved: ' + eventTags.tagit('tagLabel', ui.tag));
                },
                afterTagRemoved: function(evt, ui) {
                    addEvent('afterTagRemoved: ' + eventTags.tagit('tagLabel', ui.tag));
                },
                onTagClicked: function(evt, ui) {
                    addEvent('onTagClicked: ' + eventTags.tagit('tagLabel', ui.tag));
                },
                onTagExists: function(evt, ui) {
                    addEvent('onTagExists: ' + eventTags.tagit('tagLabel', ui.existingTag));
                }
            });

            //-------------------------------
            // Read-only
            //-------------------------------
            $('#readOnlyTags').tagit({
                readOnly: true
            });

            //-------------------------------
            // Tag-it methods
            //-------------------------------
            $('#methodTags').tagit({
                availableTags: sampleTags
            });

            //-------------------------------
            // Allow spaces without quotes.
            //-------------------------------
            $('#allowSpacesTags').tagit({
                availableTags: sampleTags,
                allowSpaces: true
            });

            //-------------------------------
            // Remove confirmation
            //-------------------------------
            $('#removeConfirmationTags').tagit({
                availableTags: sampleTags,
                removeConfirmation: true
            });

        }); 

    }
        };
        xmlhttp.open("GET", "search.php?Tags_Words="+str, true);
        xmlhttp.send();
    }
}

and this is my html input <input name="tags" id="singleFieldTags2" onkeyup="showHint(this.value);" class="tagFiledStyle"/> it works well BUT just For First Time if user delete words and type again the data json doesn't refresh ?? I really need To Fix It !!

MohammadaliMirhamed avatar Oct 24 '16 16:10 MohammadaliMirhamed

no body can answer this Question ?

MohammadaliMirhamed avatar Jan 18 '17 12:01 MohammadaliMirhamed

Hi @MohammadaliMirhamed apologies, although I'm not abandoning this project, I'm not actively maintaining this at the moment. You may have more luck trying StackOverflow, IRC, your colleagues, or contracting out assistance.

aehlke avatar Jan 19 '17 02:01 aehlke