Javascript assigning the return value of a Callback function to global variable

后端 未结 5 1348
北海茫月
北海茫月 2020-12-28 19:01

My question is about Javascript. I have a Callback function which receives a Position object on a successful callback.

The problem is that when I try to set the prop

5条回答
  •  庸人自扰
    2020-12-28 19:29

    put a console.log(x); just after x=cords to check the value (works on Chrome and FF with FireBug)

    do that also just after the call of OnSuccess.

    Also don't forget that there is asynchronous code in JS (if you use AJAX to get the position), maybe you just don't receive the answer when you check the value of x

提交回复
热议问题