Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/416.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript、ajax到PHP_Javascript_Ajax - Fatal编程技术网

javascript、ajax到PHP

javascript、ajax到PHP,javascript,ajax,Javascript,Ajax,我的代码中有这个,但它不起作用,请帮帮我,我想尝试在从下拉列表中提取时传递值,它通过onChange处理数据并在标记中显示值 <label for="headmark" class="lbl-ui select"> <select id="headmark" name="headmark" onChange="getVal(this)"> <?php while (oci_fetch($

我的代码中有这个,但它不起作用,请帮帮我,我想尝试在从下拉列表中提取时传递值,它通过onChange处理数据并在标记中显示值

<label for="headmark" class="lbl-ui select">
    <select id="headmark" name="headmark" onChange="getVal(this)">                                
    <?php while (oci_fetch($headmark_parse)){?>                                                                                     
        <option value="<?php echo $head_mark ?>" id="headmark"> 
        <?php echo "$head_mark"; ?></option> 
        <?php } ?>
    </select>
</label>  

<script type="text/javascript">
       function getVal(val){
              $.ajax( {
              type: 'POST',
              url: update_fab_progress.php,
              data: "&val=" + val, 
              success: function(data) {
                        alert("data");
              }
          } );
       }
</script>
<?php
     echo $_POST['val'];
?>


使用ChromeDeveloper工具帮助您进行调试。我认为javascript中的参数“val”有点奇怪。可能是,您发送了一个参数为空的请求。

sack。。。查看如何在jQuery中使用AJAX。
getVal(this.value)
。。。