Problems with jquery in magento

Problems with jquery in magento

Hello,

I have a problem with jquery integrated into magento. Code was used to send emails to customers (using php mail function). In IE,Chrome work fine, but not in Mozilla and Safari browsers. I have tried to host it in the server (not in magento) and it works, with all browsers. 

I tried to use "noConflict();",but didn't help.   

Does anyone know the problem??
     Many thanks for your answers.    

This is the code 



$(document).ready(function(){
$('#postcode').keyup(function() {
    $(this).val($(this).val().toUpperCase());
});
//button
$( "#confirm" ).click(function() {
  var email = $("#email").val();
var names = $("#names").val();
var pscode = $("#postcode").val();

//It shortens the post code down to 2 letters
var shortpscode = jQuery.trim(pscode).substring(0, 2);


var str = shortpscode;
var pattern = /[0-9]+/g;
var matches = str.match(pattern);
if (matches ==null) {
shortpscode = jQuery.trim(pscode).substring(0, 2);
//alert(shortpscode);
} else {
shortpscode = jQuery.trim(pscode).substring(0, 1);
//alert(shortpscode);
}



var VarData = 'email=' + email + '&names=' + names + '&shortpscode=' + shortpscode;



$.ajax({
type:"POST",
url: 'send-email.php',
data:VarData,
success: function () {
alert("O.K");
}

});
});


});