在填充在2个不同的AjaxCalls的价值观的话选择问题 [英] problem in populating the values an then selecting in 2 different ajaxcalls

查看:108
本文介绍了在填充在2个不同的AjaxCalls的价值观的话选择问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题。有在code两个Ajax调用。第一次的onClick我想用填充列表,我使用上选择一个值,以使一个AJAX调用其他JSP脚本中的第二个聚焦状态。这code只是做了第二个电话,而不是第一个。 另一件事我想是发送列表索引中的第二个Ajax调用的URL。我知道如何选择指数值(H = this.selectedIndex),但我不能够把它如果我使用它与此code为HTTP:// * /检查/index.jsp&id=6&vid =+ H

I am having a strange problem. There are two ajax calls in the code. The first onClick I want to use to populate the list and the second onfocus I am using on select a value to make an ajax call to other jsp script. This code is just making the second call and not the first. Another thing I want is to send the list index in the url of the second ajax call. I know how to select the index value (h=this.selectedIndex;) but I am not able to send it if I use it with this code as "http://*/check/index.jsp&id=6&vid="+h

推荐答案

如果你看一下事件处理程序的选择

If you look at event handler for your select

  • 的onClick - 窗体上对象 点击。
  • 的onfocus - 窗口,框架, 框架或表单元素接收 关注的焦点。
  • onClick - object on a form is clicked.
  • onFocus - window, frame, frameset or form element receives focus.

这表明,点击事件发生后,立即选择控制得到onFocus事件而这就是为什么第二AJAX调用都会执行。

It shows that immediately after click event occurs, select control get onFocus event and thats why second AJAX call always executes.

你为什么不尝试类似呼吁onChange事件,而不是聚焦状态像第二种方法:

Why don't you try something like calling second method on onChange event instead of onFocus like:

<select id='t1' onClick="Click();" onChange="handleButtonClick();"> </select>

这篇关于在填充在2个不同的AjaxCalls的价值观的话选择问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆