matthewdhenderson Posted May 26, 2015 Share Posted May 26, 2015 How can I search for XML content? There is a 4 letter min Link to comment Share on other sites More sharing options...
Necuima Posted May 26, 2015 Share Posted May 26, 2015 Hi, it would help a lot if you gave some more information - e.g., is this in response to an AJAX/jQuery callback? If so, here's an example - first the AJAX 'call': submitHandler: function(form) { // will only 'fire' the ajax post if there are no errors var formData = $('#transedit').serialize(); $.post('./edit_trans_xml.php', formData, handleResponse); return false; // So form isn't submitted. } // end submitHandler and now handling the response from the AJAX call: // Function that handles the response from the PHP script (data is in XML format): function handleResponse(data, status) { // Check that the transaction is complete: if (status == 'success') { // First clear any messages that may be there from a previous update $('#ajax_errors').html(''); $('#results').html(''); $('#blockout').html(''); // remove the two commentary lines // Now get the XML data: // First, get any errors and display them: $(data).find('error').each(function() { // $(data).find('error') creates an array (which will hopefully be empty) var dataToDisplay = $(this).text(); $('#ajax_errors').append(dataToDisplay + "<br />").show(); }); // Put any received response in the DOM and make it visible: $(data).find('result').each(function() { // $(data).find('result') creates an array (which hopefully will not be empty) var dataToDisplay = $(this).text(); $('#results').append(dataToDisplay + "<br />").show(); }); } } // End of handleResponse() function. Hope it helps but to give you advice properly, we need to know more about the issue including sample code if appropriate. Cheers. Link to comment Share on other sites More sharing options...
Recommended Posts