Guest User

Untitled

a guest
May 9th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. var theresponse1 = "";
  2. function myFunction2(callback){
  3. $.ajax({
  4. url: '//freegeoip.net/json/',
  5. type: 'POST',
  6. dataType: 'jsonp',
  7. success: function (location) {
  8. myipaddress = location.city;
  9. console.log("1st Response" + myipaddress);
  10. return location.city;
  11. }
  12. }).done(function(response){
  13. callback(response);
  14. return response;
  15. });
  16. }
  17. myFunction2(function(response) {
  18. console.log("2nd Response" + myipaddress);
  19. theresponse1 = myipaddress;
  20. theresponse2 = myipaddress;
  21. console.log("the response "+ theresponse2);
  22. });
  23. setTimeout(function(){
  24. console.log("befote");
  25. console.log(theresponse1);
  26. },2000
  27. );
Advertisement
Add Comment
Please, Sign In to add comment