Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var theresponse1 = "";
- function myFunction2(callback){
- $.ajax({
- url: '//freegeoip.net/json/',
- type: 'POST',
- dataType: 'jsonp',
- success: function (location) {
- myipaddress = location.city;
- console.log("1st Response" + myipaddress);
- return location.city;
- }
- }).done(function(response){
- callback(response);
- return response;
- });
- }
- myFunction2(function(response) {
- console.log("2nd Response" + myipaddress);
- theresponse1 = myipaddress;
- theresponse2 = myipaddress;
- console.log("the response "+ theresponse2);
- });
- setTimeout(function(){
- console.log("befote");
- console.log(theresponse1);
- },2000
- );
Advertisement
Add Comment
Please, Sign In to add comment