jQuery not parsing HTML returned from AJAX request

AlleneAutoche

New Member
I'm parsing some XML returned back from an AJAX request but I have a special case I have to check for before parsing. Sometimes the server will return some HTML and I need to perform a reload on the page if this is the case. The problem is that when I try to do a simple check for the META tag that's in the head element, I keep getting nothing returned.Below is an example of the html that is returned. \[code\]<html> <head> <title>Redirection</title> <META HTTP-EQUIV="REFRESH" URL="https://testurl/desktop"/> <META HTTP-EQUIV=Pragma CONTENT=no-cache> </head></html/>\[/code\]The below is a snippet of the jQuery that I'm using to try and debug. The xml var is what's returned from the success method of the $.ajax() call.\[code\]parseXml(xml) { $(xml).parent().find('META').each(function() { location.reload(); });}\[/code\]The .find() method never finds the META tag and exits and causes my code to break. Any suggestions would be very much appreciated.Here is the ajax call with $.ajax({ type: 'POST', url: '?action=someAction&target=someTarget', success: function(response) { try { var orders = parseXml(response); } });Here is sample xml that I usually get back\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><ORDERS> <ORDER STATUS="OPEN" ID="62452254" DATE="May 5" /> <ORDER STATUS="FILLED" ID="341411" DATE="May 8" /></ORDERS>\[/code\]
 
Back
Top