$.get sends prototype functions in request URL?
- by pimvdb
I have some prototype functions added to Object which in my opinion were practical in certain scenarios. However, I noticed that when I executed a $.get, the prototype functions are handled as data members and are sent like http://...?prototypefunc=false.
This is rather useless as I don't supply these as data members, but they are added to the query string.
To be exact, I have this code:
Object.prototype.in = function() {
for(var i=0; i<arguments.length; i++)
if(arguments[i] == this) return true;
return false;
}
$.get('http://localhost/test.php', {'test': 'foo'}, function(text) { });
The corresponding URL constructed is:
http://localhost/test.php?test=foo&in=false
How can I avoid this?