开发者

asp.net listbox onchange javascript event ajax calls out of order

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜