How do I create a random method name
- by Russ Bradberry
I plan on using JSONP to call an external webservice to get around the fact that I dont want to create a global function that could potentially conflict with the calling page. I thought that creating a random function name and passing it up would work. Something like this:
<script src="www.foo.com/b?cb=d357534">
where cb is the callback function name, the server would return
d357534({my json data});
what i want to know is how to create the random function name, im sure i could use eval but is this the best way to go about it?
essentially, what i am trying to do is this:
var d + Math.floor(Math.random()*1000001) = function(){...