Nishant Arora February 2016

How can i parse XML response by a function using jquery?

i have a function giving me response in xml format , now i want to get the value of an attribute from that xml using jquery ? please help

var xml = api.getAllAvailableMarkups();

alert(xml) 
  xmlDoc = $.parseXML( xml );
  $xml = $( xmlDoc );
  $title = $xml.find( "URI" );


alert( $title.text() );

this is my code : 1. I am getting object in first alert and in 2nd alert blank ..
2. as URI tag is available in response XML

  1. this is respones i am getting from api.getAllAvailableMarkups(); nishant.com

Answers


pritesh February 2016

If you are getting first alert as undefined then obviously the response is not properly sent or the response is not properly received from the response. Check out on server side if the response if being sent. Or create a fiddle. Otherwise, your code is good . You have done good job their. Check out the api you used.

Post Status

Asked in February 2016
Viewed 1,168 times
Voted 9
Answered 1 times

Search




Leave an answer