Bluesapphire wrote:
Hi!
    Iam using following JQuery Code:

/***************************************************/
<script type="text/javascript">

  jQuery(document).ready(function(){


                        jQuery.post(
                                         'http://api.hostip.info/country.php'
                                        ,{
                                                 ip: '12.215.42.19'
                                                ,position : true
                                         }
                                        ,function(response){

                                                        alert(response.Country);
                                        }
                                        ,'json');



                        /*

                        jQuery.post("http://api.hostip.info/country.php";, 
function(data){
                                        alert("Data Loaded: " + data);
                        });
                        */

           });


</script>

/***************************************************/

But Ima unable to get response from the link. When 'http://
api.hostip.info/country.php' is typed in browser's address bar, it
show location correctly, but in above jquery code it doesn't show
anything.

Can some one guide me, what Iam doing wrong.

Thanks in advance.


You can't use xmlHTTPRequest across domains (it's a security thing). So you need to cache this result on your server before you can get to it with javascript.

(there is a way to use json across domains though, apparently: http://docs.jquery.com/Release:jQuery_1.2/Ajax#Cross-Domain_getJSON_.28using_JSONP.29
but I don't think you can do a POST like you're doing)

Jonathan

--
Jonathan Vanherpe - Tallieu & Tallieu NV - jonat...@tnt.be

Reply via email to