JavaScript - I am getting the country code but not getting telephone country code from jquery

Asked By ashish virmani on 11-Oct-12 02:25 AM
Danasegarane Arunachalam replied to ashish virmani on 11-Oct-12 02:35 AM
Post your code
ashish virmani replied to Danasegarane Arunachalam on 11-Oct-12 02:41 AM
<body>
    <div>
      <input type="submit" id="btnSubmit" value="GetIpAddress" />
    </div>
   
    
    
    <script type="text/javascript" language="Javascript">
    // 1. Your Data Here
    function my_callback(json) {
      alert("IP :" + json.IP + " nCOUNTRY: " + json.COUNTRY);
    }

    function my_callback2(json) {
      // more information at http://api.easyjquery.com/test/demo-ip.php
      alert("IP :" + json.IP + " COUNTRY: " + json.COUNTRY + " City: " + json.cityName + " regionName: " + json.regionName + " CountryCode: " + json.countryCode3);
    }

    // 2. Setup Callback Function
   // EasyjQuery_Get_IP("my_callback"); // fastest version
    EasyjQuery_Get_IP("my_callback2","full"); // full version
</script>
    </body>
Danasegarane Arunachalam replied to ashish virmani on 11-Oct-12 02:43 AM
The code Looks like you are calling some page method using JQUERY and the results are in the format of JSON. Did you check the other part for the telephone country code. Does that page returns the country code?
ashish virmani replied to Danasegarane Arunachalam on 11-Oct-12 02:47 AM
I am getting the Country, countryRegion & countryCode like IN for india but i want +91. This is all i am getting but not getting country code in numerical.
Danasegarane Arunachalam replied to ashish virmani on 11-Oct-12 02:52 AM
This means that you have to modified the other method which is returning the IN instead of +91. Nothing more can be done in Jquery. You have to make sure that the function returns the values from the calling method.
ashish virmani replied to Danasegarane Arunachalam on 11-Oct-12 03:02 AM
Blow is the script. check i am calling a function named my_callback2 and i am doing nothing just showing an alert. please tell me how can i get the countrycode( like +91) via this function. Its giving me IP address when i write json.IP & i want to know what should i write to get the countryCode in numeric.

  <script type="text/javascript" language="Javascript">

    function my_callback2(json) {
   
      alert("IP :" + json.IP + " COUNTRY: " + json.COUNTRY + " City: " + json.cityName + " regionName: " + json.regionName + " CountryCode: " + json.countryCode3);
    }
  
    EasyjQuery_Get_IP("my_callback2","full"); // full version

</script>
Danasegarane Arunachalam replied to ashish virmani on 11-Oct-12 03:07 AM
Please note

function my_callback2(json) {

This function gets the results from some method and the return is json, You have to modify the server side method to get the respective value
ashish virmani replied to Danasegarane Arunachalam on 11-Oct-12 05:38 AM
i am using easyjquery.js file as a reference for that. I am not able to change the js file for country code to be numeric.
please help.

http://www.api.easyjquery.com/easyjquery.js