Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14355

Ajax Question

$
0
0
When I keyup on my input it runs the ajax

But on success it creates a class called well multiple times as shown in image below

[Image: 3GlIXGdE7aUN.png]



How can I make sure it only creates one class only even when keyup.

Code:
$('input[name=\'tags\']').on('keyup', function(e){
    $.ajax({
        url: "<?php echo base_url('questions/tags');?>",
        dataType: 'json',
        type: 'post',
        data: {
            tags: $('input[name=\'tags\']').val()
        },
        success: function(json) {
            $('<p class="well"></p>').insertAfter($("input[name='tags']"));
        }
    });

});

Viewing all articles
Browse latest Browse all 14355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>