• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ajax Question

#1
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']"));
        }
    });

});
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
Ajax Question - by wolfgang1983 - 03-25-2017, 02:08 AM
RE: Ajax Question - by Wouter60 - 03-25-2017, 02:36 AM
RE: Ajax Question - by wolfgang1983 - 03-25-2017, 02:52 AM
RE: Ajax Question - by Wouter60 - 03-25-2017, 03:04 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.