First, make proper use of XML: <root> <status>Success</status> <response> <div> <label for="SlotsOffered" id="SlotsOfferedLabel">Number of Slots</label> <input id="SlotsOffered" name="SlotsOffered" type="text" value="1"/> </div> </response> </root>
Then it's easy: $.get('myserver.xyz', function(data){ var $xml = $(data); var status = $xml.find('status').text(); if ('Success' == status){ $('#myelement').html( $xml.find('response').html() ); } },'XML'); On Sep 18, 9:53 pm, mahen <kunwarma...@gmail.com> wrote: > Hi, > > Can someone help me with a simple requirement. I want to use AJAX > where the response from server side would be an XML with root element > has two divs one for status with values success or failure and other > child is HTML which needs to replaced if first div is success. eg. > > <root> > <div id="status">Success</div> > <div id="response> > <div> > <label for="SlotsOffered" > id="SlotsOfferedLabel">Number of Slots</label> > <input id="SlotsOffered" > name="SlotsOffered" type="text" value="1"/> > </div> > .......................................... > .......................................... > </div> > </root> > > So if there is status success we need to replace a tag in existing > HTML with response. Can some help me with it. Give me direction as to > how to do it. > > Mahen