0
나는 다음과 같은 코드를 가지고 있는데, 나는 jQuery와 같은 것을 달성하려고 노력 중이다. 나는 가까이에 오는 몇 가지 해결책을 찾았지만 아직 완벽한 솔루션을 찾고 있습니다. jQuery와 AJAX로 다양한 PHP 페이지를로드하는 한 가지 기능
function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.send(null);
}
}
는 지금은 함께 기능을 트리거하고 있습니다 :
<input type = "button" value = "TEST" onclick = "getData('subject_selectAJAX.php?course_id=1', 'ajax')"
>
function getData() {
//generate the parameter for the php script
$.ajax({
url: "something.php", //i want this to be passed to the function
type: "GET",
data: data,
cache: false,
success: function (html) {
//add the content retrieved from ajax and put it in the #ajax div
$('#ajax').html(html);
//display the body with fadeIn transition
$('#ajax').fadeIn('slow');
}
}); }
저는이 부분에 대한 도움을 많이 받고 싶습니다. 현재 다른 Ajax jQuery 초보자에게 도움이 될만한 항목이라는 것을 알고 있습니다.