Need help in jquery and ajax

Need help in jquery and ajax

Hi , I am developing html 5 mobile app using jquery mobile. I want to do an operation which actually takes the user name and password as input and login. This actually involves in communicating the cloud. I tried using ajax script but it din't work. 
   The most common error am getting is ReferenceError: "Can't find variable: $"

am actually following
 $.Ajax({
url:
type: "POST",
data:'uname=' + encodeURIComponent(document.getElementById("uname")) + '&password=' + encodeURIComponent(document.getElementById("password")),
//    processData: false,
contentType: "application/x-www-form-urlencoded",
accepts: {
       xml: 'text/xml',
       text: 'text/plain'
},
error: function(data) {
       alert("Error: " + status);
   },
success: function() {
       alert("Success!");
    window.location="login.html";
    }
});
});

can any one help me on this. Please.