将函数参数从onchange传递到JavaScript函数

将函数参数从onchange传递到JavaScript函数,javascript,ajax,Javascript,Ajax,好的,当下拉框被更改时,我目前正在使用AJAX更新我的部分站点,但是我在传递函数可用的参数时遇到了问题 以下是HTML: <script type='text/javascript' src='ajax.js'></script> //Where to find function <div id="combobox" style="width: 150px; height: 300px; overflow-y: scroll"> <select o

好的,当下拉框被更改时,我目前正在使用AJAX更新我的部分站点,但是我在传递函数可用的参数时遇到了问题

以下是HTML:

<script type='text/javascript' src='ajax.js'></script> //Where to find function

<div id="combobox" style="width: 150px; height: 300px; overflow-y: scroll">
  <select onchange="MakeRequest(test); location = this.options[this.selectedIndex].value;"> 
    <option>Races</option>

    <?php ComboBox() ?>
  </select>
   .
   .
我怎样才能让它工作

location=this.options[this.selectedIndex].value
这会将页面更改为其他位置。这不是AJAX,请删除它


相反,把
this.options[this.selectedIndex].value(或者只是
this.value
-同样的东西)放在
test

代码中发生的事情是,首先调用了
MakeRequest()
函数,但它会立即返回(因为ajax是异步的),因此将调用
onchange
属性的下一部分,并将用户重定向到另一个页面

要进行测试,请使ajax调用同步。请参阅。


location=this.options[this.selectedIndex].value
<select onchange="MakeRequest(this.value); " />