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.
position = navigator.geolocation.getCurrentPosition? because that would be invalid.position = navigator.geolocation.getCurrentPosition(...)would also be invalid.