Всем привет!
Есть тестовая страница:
http://www.gelomyrtol-forte.ru/test.php
Туда я хочу подгрузить данные вот отсюда:
smacs.kapteka.ru/exchange/price
Вот код самой страницы вместе с Ajax вызовом:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js">
</script>
</head>
<body>
<?
//header('Access-Control-Allow-Origin: *');
?>
<script type="text/javascript">
$.ajax({
url:'http://smacs.kapteka.ru/exchange/price',
username: 'login',
password: 'password',
dataType: 'jsonp',
crossDomain : true,
xhrFields: {
withCredentials: true
},
success: function(data){
var json = $.parseJSON(data);
console.log(json);
//alert('success');
},
error: function(xhr, status, err){
console.error('http://smacs.kapteka.ru/exchange/price', status, err.toString());
}
});
</script>
<div class="data">
123
</div>
</body>
</html>
Но почему то постоянно вываливаются 2 ошибки: Unexpected token < и
test.php:9
http://smacs.kapteka.ru/exchange/price parsererror Error: jQuery2240233584032602433_1516696335809 was not called
логин и пароль я поставил правильные, т.к. если в браузер просто вставить
http://login
assword@smacs.kapteka.ru/exchange/price
то данные в браузер подгружаются.
Народ, помогите пожалуйста, может кто с этим сталкивался?