I have a listbox. A simple master-detail kind of page. I am handling the onchange like this:
onchange="lbchange(this.options[this.selectedIndex].value);"
My lbchange() javascript function makes an jquery ajax call to fill some fields on the page. The selected value is the PK and I get json results from the page's webmethod. All working great.
Problem: If I scroll in the listbox with the arrow keys say to the top entry in the list box. The ajax calls or events seem to happen out of order. Not FIFO.开发者_JAVA技巧 Lets say if I have Bill Clinton selected and George Washington is at the top of the list box. If I hold down the arrow key and arrow all the way to the top to select George Washington, I will see George Washington flash by in my details. Yet Abe Lincolns details will be displayed with George Washington selected. It is like the newer javascript events (onchange) are interrupting the older ones and then the older ones finish afterword.
Guess I forgot what the A in AJAX means. Just call jquery abort on the previous ajax request.
精彩评论