Программирование на jquery
-
Anonymous
Проблема Cors с вызовом ajax [дубликат]
Сообщение
Anonymous »
Как решить проблему с Cors с помощью приведенного ниже кода. перепробовал все методы.
буду благодарен за любую помощь.
Код: Выделить всё
$(document).ready(function() {
$('#ajaxbtn').click(function() {
$.ajax({
url: 'https://www.easyprogramming.net/heroes.json',
method: 'GET',
success: function(data) {
let html = 'IDTitle';
data.slice(0, 5).forEach(function(post) {
html += '' + post.id + '' + post.title + '';
});
html += '';
$('#ajax-content').html(html);
}
});
});
});
AJAX Button
Name
Superhero Name
City
Подробнее здесь:
https://stackoverflow.com/questions/786 ... -ajax-call
1719411730
Anonymous
Как решить проблему с Cors с помощью приведенного ниже кода. перепробовал все методы.
буду благодарен за любую помощь.
[code]
$(document).ready(function() {
$('#ajaxbtn').click(function() {
$.ajax({
url: 'https://www.easyprogramming.net/heroes.json',
method: 'GET',
success: function(data) {
let html = 'IDTitle';
data.slice(0, 5).forEach(function(post) {
html += '' + post.id + '' + post.title + '';
});
html += '';
$('#ajax-content').html(html);
}
});
});
});
AJAX Button
Name
Superhero Name
City
[/code]
Подробнее здесь: [url]https://stackoverflow.com/questions/78672937/cors-issue-with-ajax-call[/url]