<suggestions>
<user>
<![CDATA[ Chris ]]>
</user>
<user>
<![CDATA[ Christina ]]>
</user>
</suggestions>
и JS частьJQuery AJAX запрос возвращаемые XML
$.ajax({
type: "POST",
url: 'index.php/Suggest/',
dataType: 'xml',
data: {username: username},
success: function(data) {
$(data).find('suggestions').each(function(){
if ($(this).find('user').text()) {
$('#container').html('<div>' + $(this).find('user').text() + '</div>');
}
});
},
error: function(request, status, error) {
// will also occur when the user toggles a window and instantly clicks on a link, so don't alert anything
}
});
вставки
<div>ChrisChristina</div>
, но я хочу
<div>Chris</div> <div>Christina</div>
'успех:. Функция (данные) { \t \t \t \t \t \t $ ('# cChatMenuContentContainer') пусто(); \t \t \t \t \t \t $ (данные) .find ('пользователь') каждый (функция() { \t \t \t \t \t \t \t $ ('# cChatMenuContentContainer') добавление ('