JQUERY Loop from a AJAX Response

Posted by nobosh on Stack Overflow See other posts from Stack Overflow or by nobosh
Published on 2010-03-19T00:39:44Z Indexed on 2010/03/19 0:41 UTC
Read the original article Hit count: 283

Filed under:
|
|
|

I'm building a tagger. After a user submits a tag, ajax returns:

{"returnmessage":"The Ajax operation was successful.","tagsinserted":"BLAH, BLOOOW","returncode":"0"}

I want to take the tagsinserted and loop through it, and during each loop take the item in the list and insert it on the HTML page. suggestion on how to do this right?

Here is the current code:

$("#tag-post").click(function(){
    // Post $('#tag-input').val()
    $.ajax({
        url: '/tags/ajax/post-tag/',
        data: { newtaginput : $('#tag-input').val(), userid : $('#userid').val()},
        success: function(data) {
            // After posting
            alert('done');

        }
    });     

});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about loops