All good!

On ajax request, the server responds to me xml with the following content:

request code:

$.get( "https://адрес сервера", { "Param1": "0" }, onAjaxSuccess ); function onAjaxSuccess(data) { console.log(data); } 

server response:

 <root> <Node1 EventDate="27.08.2017 8:00:00"></Node1> <Node2 EventDate="27.08.2017 16:00:00"></Node2> <Node3 EventDate="28.08.2017 8:00:00"></Node3> <Node4 EventDate="28.08.2017 16:00:00"></Node4> <Node5 EventDate="29.08.2017 8:00:00"></Node5> ....... ....... ....... <Node34 EventDate="25.09.2017 8:00:00"></Node34> </root> 

You just need to compile the contents of EventDate into an array:

 ["27.08.2017 8:00:00", "27.08.2017 16:00:00", "28.08.2017 8:00:00" ..... ] 

Thanks to all!

    1 answer 1

    We wrap in $ , and then we work as with ordinary HTML, searching for all elements with the EventDate attribute and extracting data from them:

     var response = '<root><Node1 EventDate="27.08.2017 8:00:00"></Node1><Node2 EventDate="27.08.2017 16:00:00"></Node2><Node3 EventDate="28.08.2017 8:00:00"></Node3><Node4 EventDate="28.08.2017 16:00:00"></Node4><Node5 EventDate="29.08.2017 8:00:00"></Node5><Node34 EventDate="25.09.2017 8:00:00"></Node34></root>'; var data = []; $(response).find('[EventDate]').each(function() { data.push($(this).attr('EventDate')); }); console.log(data); 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 

    • Works! Thank!! - Dmitry Spiridonov