1. JSONP (JSON with padding)
Cross-Domain Ajax Requests
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="http://localhost/library/jquery/jquery.min.js"></script>
</head>
<body>
<div id="results">results</div>
<script type="text/javascript">
$.ajax({
url: 'http://hoguom.com/data',
dataType: 'jsonp',
jsonpCallback: 'handleResponseCallback' // chỉ định tên của callback function
});
function handleResponse(response) {
$('#results').html(response);
}
</script>
<script src="http://hoguom.com/data"></script>
</body>
</html>
Mở đầu
1. JSONP (JSON with padding)
Ưu điểm và nhược điểm
PreviousCross-Domain Ajax RequestsNext2. CORSCross-origin resource sharing (CORS) là một cơ chế đặc biệt cho phép resource đặt tại một do
Last updated