0
XML을쇼 JQuery와 대화
<?xml version="1.0" encoding="utf-8"?>
<Questions>
<Question>
<Id>1</Id>
<Text>aaaa</Text>
</Question>
<Question>
<Id>2</Id>
<Text>bbb</Text>
</Question>
</Questions>
HTML
<table dir="rtl" width="400px">
<tr>
<td>
<span id="signuptitle">ques* : </span>
</td>
<td>
<select id="sctQuestion" name="D2">
<option></option>
</select>
</td>
</tr>
코드 1
function PopupUserRegist() {
$.ajax({
type: "GET",
url: "../Administrator/Questions.xml",
success: parseXmlQuestion
});
function parseXmlQuestion(xml)
{
$(xml).find("Question").each(function()
{
var value=$(this).find('Text').text();
$("#sctQuestion").
append($("<option></option>").
attr("value",value).
text(value));
});
}
$("#div_userregist").dialog("open");
}
$(function() {
$("#dialog:ui-dialog").dialog("destroy");
$("#div_userregist").dialog({ autoOpen: false,
buttons: {
"ok!": function() {
}
});
});
이 코드 가져 오기 XML 성공.
============================================== ============================
CODE2
function PopupUserRegist() {
$.ajax({
type: "GET",
url: "../Administrator/Questions.xml",
success: parseXmlQuestion
});
function parseXmlQuestion(xml)
{
$(xml).find("Question").each(function()
{
var value=$(this).find('Text').text();
$("#sctQuestion").
append($("<option></option>").
attr("value",value).
text(value));
});
}
$(function() {
$("#dialog:ui-dialog").dialog("destroy");
$("#div_userregist").dialog({ autoOpen: true,
buttons: {
"ok!": function() {
}
});
});
}
이 코드는 XML의 성공을하지 않습니다.
============================================== ===================
=========================== ======================================
코드 1에:에 AutoOpen : 허위의 CODE2는 :에 AutoOpen : 코드 1의 진정한
는 XML 성공하지만 CODE2에서 얻을 : XML을하지 않습니다.