JQUERY Loop from a AJAX Response
- by nobosh
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');
}
});
});