1

Firebug is reporting that

$ is not defined [Break On This Error] $(function(){

I have a simple index.php page that does a php include to include the contents I need.

The contents are as follows:

<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>

I do this in other places and I am fine. I don't understand the error.....

1
  • 10
    Did you forget to import jQuery? Commented Mar 24, 2011 at 15:53

3 Answers 3

7

Did you include the jQuery library?

Sign up to request clarification or add additional context in comments.

1 Comment

Hmmm, answer with a question, why didn't I think of that?
4

Add this before your script tag. It uses google's CDN.

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>

Comments

4

Are you including jQuery at the top of your script?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.