-им Tryin для заполнения флажков и установить их значения из файла XML с помощью JQuery с помощью folloowing коды ... проблема ее не работает может кто-нибудь плзла скажи мне, Что им делают неправильнозаселения флажков из XML с помощью JQuery
$(document).ready(function(){
$.ajax({
type: "POST",
url: "controls.xml",
dataType: "xml",
success: function(xml) {
var node = $(xml).find('node');
var attribute = $(xml).find('node').attr("attribute");
//TODO: do something with data
$(xml).find('checkbox').each(function() {
var value = $(this).text(); // get the value whether the checkbox is checked or not
var name = $(this).attr("name"); //get the name attribute
var val = $(this).attr("value"); // get the numeric value of the control e.g. 100
$("#Controls").append(//append to some parent container
$("<input/>") // a new input element
.attr("type", "checkbox") //of type checkbox
.attr("name", name) // with given name
.attr("checked", value) // checked="checked" or checked=""
.attr("value", val)//value= specified value
)
});
}
});
});
вот пример моего XML
<?xml version="1.0" encoding="utf-8" ?>
<RootElement>
<checkbox name="StaticPage" value="100"></checkbox>
<checkbox name="FlashPage" value="200"></checkbox>
<checkbox name="PhotoGalary" value="250"></checkbox>
<checkbox name="CompletePackage" value="1000"></checkbox>
<checkbox name="DiscountPAckage" value="800"></checkbox>
</RootElement>
что ошибка/проблема вы столкнулись ? –
не могли бы вы дать нам образец xml? – generalhenry
Ваш URL правильно? он говорит control.xml – kobe