Javascript无法发送数据

时间:2013-12-02 17:28:39

标签: javascript php mysql ajax jquery

这是一个脚本,它将文本框的信息发送到另一个页面,信息将被插入到mysql数据库中。

<script type="text/javascript">
    // <![CDATA[
    $(document).ready(function(){   
        // click to submit an event
        $('#Create').click(function(){

            var a = $("#EventInput").val();

            if(a != "What are you planning?")
            {
                $.post("concorunt.php?val=1&id=<?php echo $id?>&"+$("#EventForm").serialize(), {
                }, function(response){
                    $('#ShowEvents').prepend($(response).fadeIn('slow'));
                    clearForm();
                });
            }
            else
            {
                alert("Enter event name.");
                $("#EventInput").focus();
            }
        }); 
</script>

但没有发生任何事情。

1 个答案:

答案 0 :(得分:0)

您没有关闭文档ready功能。试试这个:

$(document).ready(function(){ 
// <![CDATA[   -->  Either remove this or close this.
.....
.....
}); //Missing those braces in your code