views:

14

answers:

1

I am trying to insert following snippet in my JSP file

{
    $.ajaxSetup({
        cache: false,
        async: false
    });
    var ajax_load = "loading data please wait...";
    var loadUrl = "abc.jsp";

    $("#seoarea").html(ajax_load).load(loadUrl, {
        param1: holdvalue1,
        param2: holdvalue2
    });
}

While running this on mozilla firfox its throwing "$.ajaxSetup is not a function" error.

+1  A: 

This error could happen if you forgot to reference the jQuery library in your page:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"&gt;&lt;/script&gt;

It could also happen if you are using other js libraries such as prototypejs which also use the $ function and there could be a conflict. If this is the case you may take a look at this article on how to resolve the issue.

Darin Dimitrov
+1 - But please uses the latest version in examples! It's 1.4.2 currently, several bug fixes in there.
Nick Craver