Firebug报告说

$未定义
[中断此错误] $(function(){

我有一个简单的index.php页面,该页面包含一个php,以包含我需要的内容。

内容如下:

<script type="text/javascript">
$(function(){
    $("#ipad").submit(function() {
        $.post("ipadcheck.php", $("#ipad").serialize(),
        function(data) {
            if(data.error == 'TRUE') {
                    $("#results_ajax").html("<div class='AppleRedBold'>Sorry There were     Errors: " + data.error_message + "</div>");
            } else {
                $("#results_ajax").html("<div class='AppleRedBold'>" + data.display + "    </div>");
            }
        }, "json");

        return false;

    });
});
</script>

<div class="paragraph_style" id="results_ajax"></div>

    <div class="paragraph_style">
        <form id="ipad" name="ipad">
                <label class="paragraph_style" for="txtZip">Zip Code:     </label>
                <input class="searchBox Black" id="txtZip" name="txtZip" type="text" />
                <br /><br />
                <input type="submit" value="Submit">
        </form>
    </div>
</div>


我在其他地方也可以,我很好。我不明白这个错误.....

最佳答案

您是否包括jQuery库?

关于php - $未在JavaScript中定义,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5421910/

10-11 02:40
查看更多