Jump to content

give effects to ajax


gongpex

Recommended Posts

Hello everyone,

 

I had build ajax live search using JQuery to display data from my database using PHP,

 

It can show the suggestion, but I want to display it using either of effects like slideDown or Fade,

 

I had tried it but it's didn't work, this my code :

$(document).ready(function() {      $("#suggestion").on('keyup focus',function() {        var selTable = $(this).val(); // selected name from search box      $.ajax({            type: "GET",        url: "<?php echo base_url();?>/index.php/search/product/",         data : {'suggest':selTable},        dataType: "html",   //expect html to be returned                        success: function(response){                                $("#responsecontainer").html(response).slideDown("slow");         }      });   });}); 

or

$(document).ready(function() {      $("#suggestion").on('keyup focus',function() {        var selTable = $(this).val(); // selected name from search box      $.ajax({            type: "GET",        url: "<?php echo base_url();?>/index.php/search/product/",         data : {'suggest':selTable},        dataType: "html",   //expect html to be returned                        success: function(response){                                $("#responsecontainer").html(response).fadeOut("slow");         }      });   });}); 

Q : What mistake on my code?

 

please help me

 

Thanks

Link to comment
Share on other sites

It's hard to read your code, you should at least format it with proper indentation. You also don't mention what is happening. Are you checking for errors? What about the success of the request / response to the server?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...