Ajax 의 jsonp 방식 으로 도 메 인 을 넘 어 데 이 터 를 가 져 오 는 간단 한 인 스 턴 스
<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#b01").click(function(){
$.ajax({//danielinbiti.txt :getAInfo(["<input type='text' value='1222'/>"])
url: 'http://192.168.12.21:8080/systemr/danielinbiti.txt',
dataType: 'jsonp',// jsonp
processData: false,
jsonpCallback:'getAInfo',// getAInfo
type: 'get',
success: function(data) {
$("#myDiv").html(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('error');
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.readyState);
alert(textStatus);
}
});
});
$("#b02").click(function(){// request callback, callback( json ) ,getJSON ajax , json
$.getJSON("http://192.168.12.21:8080/systemr/b.do?jsoncallback=?",function(result){
$("#myDiv").html(result);
});
});
});
</script>
</head>
<body>
<div id="myDiv"><h2> AJAX </h2></div>
<button id="b01" type="button"> 01</button>
<button id="b02" type="button"> 02getJSON</button>
</body>
</html>
이상 의 Ajax 의 jsonp 방식 으로 도 메 인 을 넘 어 데 이 터 를 얻 는 간단 한 인 스 턴 스 는 바로 작은 편집 이 여러분 에 게 공유 하 는 모든 내용 입 니 다.참고 가 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Javascript Ajax에 대한 간단한 연습저는 약 4년 동안 프로그래밍 개인 튜터로 일한 경험이 있습니다. 약 5년 전에 " "이라는 제목의 페르시아어로 내 웹사이트에 블로그 게시물을 올렸고 사람들이 저에게 전화하기 시작했습니다. 나는 항상 사람들을 가르치...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.