Welcome Guest, Not a member yet? Register   Sign In
How to prevent every dropdown option to call ajax?
#1

Hi, Guys.

I have a select with 999 options:

<select>
<option value='1'>Mary</option>
<option value='2'>John</option>
...
<option value='999'>Carl</option>
</select>

Everytime an user select an option the ajax calls a Controller to get the profile and shows it at screen.

But if an user keep pressing the keyboard "down" the ajax will call the Controller 999 times (or less).

How can i prevent this behavior?
Reply
#2

$('. Class').on("keydown",function (e) {
console.log("handled by the child - stop bubbling please");
e.preventDefault();
e.stopPropagation();
});
Enlightenment  Is  Freedom
Reply
#3

its better to use cache
Reply




Theme © iAndrew 2016 - Forum software by © MyBB