I am using jquery Ajax following line of code having problem only with Firefox and Blackbarry browsers
postion:
navigator.geolocation.getCurrentPosition(currentPosition);
function currentPosition(res){
window.res = res;
}
Code:
var postion = window.res;
$.ajax({
url: 'SendLocation',
type: 'post',
data: position, // Position is navigator.geolocation.getCurrentPosition
success: function(res){
alert(res);
}
});
Error:
NS_ERROR_XPC_BAD_OP_ON_WN_PROTO: Illegal operation on WrappedNative prototype object
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
After reading FormData Object not submitting via jQuery AJAX call post I added following line of code and code become processData: false, contentType: false,
Updated code:
$.ajax({
url: 'SendLocation',
type: 'post',
data: position, // Position is navigator.geolocation.getCurrentPosition
processData: false, //Added this line
contentType: false, //Added this line
success: function(res){
alert(res);
}
});
with this no error was oucurring but code also stops working.
I suggest using serialize() on your position variable as it would be trying to send the geolocation DOM object..
https://developer.mozilla.org/en-US/docs/DOM/window.navigator.geolocation.getCurrentPosition
This error would show up if you were using firebug and inspecting your POST vars.
Thanks all guess for helping me out but here let me tell you what I did. I just just select my required values from the position object and create a new object and filled it with my data that I got from position and POST it to the server and now its working fine Thanks..!