본문 바로가기

[IT/Programming]/HTML related

Learning AJAX

728x90
반응형
# Learning AJAX AJAX 란 "Asynchronous JavaScript and XML" 의 약자로 비동기적으로 서버에 무언가 요청을 보낼때 쓰인다. 유저가 댓글을 쓴다던지, 새로 업데이트 된 댓글을 불러온다던지 할 때, 새 창을 띄우지 않고도 서버와 데이터를 주고받는 것을 가능하게 해주는 것이다. 자세한 설명은 에 잘 되어 있으니 여길 잘 참고하시길...
In general, Ajax does not work across domains. For instance, a webpage loaded from 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.
## TOC ## AJAX test button AJAX test button : ```[#pre-code-tistory-comment.linenums.lang-html] ```/ ```[#pre-code-code.linenums.lang-html] ```/




## 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(m.escapeHTML(resp));
		$result.removeClass("prettyprinted");
		PR.prettyPrint(function(){}, $result.parent()[0]);
	}
});
```/





## RRA

    Tutorial

  1. w3schools.com - AJAX
  2. 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()."
  3. stackoverflow.com - How to start learning Ajax?, 2010-08-21;
728x90
반응형