Error while using ajax with jquery

Error while using ajax with jquery

Hi,
 
  I have an HTML page with a button. I am trying to execute a function from one of the js file "myapp.js" when I click on the button.
 
  The function is something like
 
 

function

changeMapLocation() {

var addressval = $( "#address" ).val();

var address;

var url;

var googleUrl= "http://maps.google.com/maps/api/geocode/json?" ;

var sensor = "&sensor=false" ;

if (addressval != null && addressval != "" && addressval.length!=0) {

address =

"address=" + encodeURIComponent(addressval);

$.ajax({

url:googleUrl+address+sensor,

type:

"POST" ,

dataType:

"json" ,

success:

function (longlatJson) {

alert(

"hi2" );

var jsonObj = JSON.parse(JSON.stringify(longlatJson));

alert(

"hi3" );

var lat = jsonObj.results[0].geometry.location.lat;

var long = jsonObj.results[0].geometry.location.lng;

alert(

"hi4" );

var latlng = new google.maps.LatLng(lat, long );

map.panTo(latlng);

},

error:

function (){alert( "unable to conect to google server" );}

});

}

}
 
---------------------------------------------------------------------------------------------------------------------------------------
 
But when the control enters the line
$.ajax({
 
its throwing error
Access to restricted URI denied" code: "1012
 
But I could run the rest of the functions without ajax call.
 
Am I missing any references? Can anyone help me in solving this issue?
 
Thanks,
Shobha