Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.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 表单不使用jquery和post发送值_Javascript_Php_Jquery_Html - Fatal编程技术网

Javascript 表单不使用jquery和post发送值

Javascript 表单不使用jquery和post发送值,javascript,php,jquery,html,Javascript,Php,Jquery,Html,这是我的代码,当我点击按钮时没有正确地提醒表单,我不知道我是否因为匆忙而做错了什么 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> <script src="http://code.jquery.com/jquery-

这是我的代码,当我点击按钮时没有正确地提醒表单,我不知道我是否因为匆忙而做错了什么

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <link rel="stylesheet" href="form.css" />
    <script>
        $(document).ready(function(){
            $("#button").click(function(){
                var form = $("#form").serialize();
                alert(form);
                $.post("action.php", form, function(data){
                    $("#response").html(data);
                });
            });                
        });
    </script>
</head>
<body>
    <form id="form">
        <table>
            <tr colspan="2" style="text-align: center;">
                <td><b>Formulario</b></td>
            </tr>
            <tr>
                <td>C&oacute;digo Alumno:</td>
                <td><input type="text" id="alumno" /></td>
            </tr>
            <tr>
                <td>C&oacute;dido curso:</td>
                <td><input type="text" id="curso"/></td>
            </tr>
            <tr>
                <td>C&oacute;digo profesor:</td>
                <td><input type="text" id="profesor"/></td>
            </tr>
            <tr>
                <td>Correo profesor:</td>
                <td><input type="text" id="correo"/></td>
            </tr>
            <tr>
                <td>Descripci&oacute;n:</td>
                <td><textarea rows="10" cols="30"></textarea></td>
            </tr>
            <tr>
                <td colspan="2"><input type="button" id="button" value="Enviar"/></td>
            </tr>
            <tr>
                <td></td>
                <td></td>
            </tr>
        </table>
    </form>
    <div id="response"></div>
</body>
</html>

您应该像这样向输入控件添加name属性

<input type="text" id="correo" name="correo" /></td>

然后您的action.php将获得所需的参数。

您正在做一些事情,因为您很匆忙,这不是产生错误的页面
<input type="text" id="correo" name="correo" /></td>