이베이 카테고리의 카테고리 트리 선택을하고 있습니다. 내가 첫 번째 범주 (위) 선택에 따라 다른 선택 상자를 반환하는 내 PHP 응용 프로그램에 데이터를 게시하려면 다음 JQuery와 기능을 사용하고 내가 선택 상자를
...반환 된 데이터가 소스 코드에 표시되지 않습니다. 어떻게 Ajax로드 된 데이터를 선택합니까?
<div id="div_firstCat">
<select id="slct_firstCat" name="slct_firstCat" size="33">
<option value="353">Antiques</option>
<option value="550">Art</option> ... and so on..
</select>
</div>
<div id="div_secondCat"></div>
.
// First Level Categories
$("#slct_firstCat").change(function(){ // On change of slct_firstCat
var actionRequested = "AJAX_getCats"; // My personal PHP Identifer
var url = "index.php"; // Post to index.php
var catId = $("#slct_firstCat").val(); // Get the CatID from the select box.
// Post this data to PHP and return the data into #div_secondCat
$.post(url, {AJAX_Action: actionRequested, categoryId: catId, categoryLevel: 1},
function(data){
$("#div_secondCat").html(data);
});
// End of Function getCats
});
PHP 파일은이 선택 상자와 동일하지만 다른 이름을 반환합니다.
<select id="slct_secondCat" name="slct_secondCat" size="33">
<option value="353">Sub-Cat of Antiques</option>
<option value="550">Sub-Cat of Antiques</option> and so on..
</select>
가 지금은 "slct_secondCat"(AJAX를 통해로드 된 선택)에서 JQuery와 통해 옵션 값을 얻을하려고 할 때,이 옵션 값을 얻을 나던, 그래서 나는 고양이 나무 아래로 더 이동 캔트.
두 번째 범주 게시물에 대한 JQuery 함수입니다.
// Second Level Categories
$("#slct_secondCat").change(function(){
var actionRequested = "AJAX_getCats";
var url = "index.php";
var catId = $("#slct_secondCat").val();
$.post(url, {AJAX_Action: actionRequested, categoryId: catId, categoryLevel: 2},
function(data){
$("#div_thirdCat").html(data);
});
// End of Function getCats
});
AJAX와이 사업부는 데이터가 그것으로로드하더라도, 데이터, 소스 코드 내부의 div_secondCat 나던 디스플레이 아무것도로드 후 나는 페이지의 소스 코드를 보면
는, JQuery와는 데이터를 반환 div에 게시하고 페이지의 소스 코드를 업데이트하지 않았습니다.기본적으로 나는 PHP 파일에서 eBay 웹 서비스를 통해 카테고리를 얻고 싶습니다. 원하는 최종 카테고리로 이동하고 JQuery를 통해 선택할 수 있습니다.
안녕하세요, 내 스크립트에서 또 다른 오류가 발생했습니다! .live 잘 작동, 감사합니다 !!! – Anil
굉장합니다. 다행스럽고 기쁘다. 건배. –