I have working code
var url = 'http://ip.jsontest.com/';
$.ajax({
url: url,
dataType: "jsonp",
async: false,
success: function (result) {
alert('success');
},
error: function (request,error) {
alert(error);
}
});
That code yield 'success'. But when i change the json url (http://ip.jsontest.com/) to 'http://example.com' with this PHP code
<?php
header('Content-Type: application/json; charset=utf-8');
$iii = array('ip' => '114.79.28.24' );
echo json_encode($iii);
?>
I got an error
What's wrong?