In general, Ajax does not work across domains. For instance, a webpage loaded from
## TOC
## AJAX test button
AJAX test button :
## jQuery.get()
```[.scrollable.lang-js]
$.ajax({
type:"GET"
, url:"/rss"
, dataType:"text"
, success:function(resp){
// console.log(resp);
var $result=$("#ajax-get-test-result");
$result.html(kipid.escapeHTML(resp));
$result.removeClass("prettyprinted");
prettyPrint(function(){}, $result.parent()[0]);
}
});
```/
## RRA
example1.com
is unable to make an Ajax request to example2.com
as it would violate the same origin policy. As a work around, JSONP (JSON with Padding) uses <script>
tags to load files containing arbitrary JavaScript content and JSON, from another domain. More recently browsers have implemented a technology called Cross-Origin Resource Sharing (CORS), that allows Ajax requests to different domains.
- w3schools.com - AJAX
- learn.jquery.com - AJAX; and api.jquery.com - AJAX - jQuery.ajax()
"Unfortunately, different browsers implement the Ajax API differently."
"It offers both a full-featured$.ajax()
method, and simple convenience methods such as$.get()
,$.getScript()
,$.getJSON()
,$.post()
, and$().load()
." - stackoverflow.com - How to start learning Ajax?, 2010-08-21;
Tutorial
'[IT/Programming] > HTML related' 카테고리의 다른 글
Interactive graph and chart in HTML (0) | 2019.02.19 |
---|---|
페이스북 퍼오기 (Embeding facebook post) (0) | 2019.02.18 |
트위터 트윗 퍼오기 (Embedding Twitter Tweet) (0) | 2019.02.18 |
CSP (Content Security Policy) : iframe, image (img), video blocking (0) | 2019.02.18 |
Youtube Download (0) | 2019.02.18 |
Change browser URL (window.location) without reloading or redirecting a page (0) | 2019.02.18 |
Learning AngularJS (0) | 2019.02.18 |