Hello,

I have been looking at this for a few days now and I am not having any
luck.

I am using jQuery 3.1.1.

I don't think I have any character encoding issues, all files are in
UTF-8 format.

Is it possible that I left a header out when creating the XML file -
like the doctype=text/xml? If so how do I make sure this is added?

Well thanks for taking a look. :D


MY HTML + JS
-----------------------------------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="charset=utf-8">
<title>New Products</title>
<script type="text/javascript" src="/includes/jQuery/jquery.js"
language="JavaScript"></script>
<script type="text/javascript" language="javascript">
<!--
$(document).ready(function(){
  $.ajax({
    url: '/includes/xml/newProducts.xml',
    type: 'GET',
    dataType: 'xml',
    timeout: 2000,
    error: function (xhr, desc, exceptionobj) {
                alert(xhr.responseText);
        },
    success: function(reply){
                //find every productsRow and print the gpn
                $(reply).find('productsRow').each(function(){
                        $("#output").replaceWith($(this).find("gpn").text()+ 
'<br />');
                });
    }
  });
});
-->
</script>
</head>
<body>
<h4>New Products Feed Hello World</h4>
<div id="output">Target Output DIV</div>
</body>
</html>

-----------------------------------------------------------


MY XML
-----------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<products>
<productsRow>
  <gpn>1N4148WS</gpn>
  <gpnDescription>Small Signal Diode</gpnDescription>
  <productFamily>Small Signal Diode</productFamily>
  <productFolderLink>/pf/1N/1N4148WS.html</productFolderLink>
  <datasheetLink>/ds/1N/1N4148WS.pdf</datasheetLink>
  <buyLink>/ShoppingExperience/action/displayItems?
gpn=1N4148WS&amp;itemType=BUY</buyLink>
  <sampleLink>/ShoppingExperience/action/displayItems?
gpn=1N4148WS&amp;itemType=SAMPLE</sampleLink>
  <orderableParts>
    <partsRow>
      <opn>1N4148WS</opn>
      <packageId>SOD-323F</packageId>
      <partStatus>S</partStatus>
      <greenStatus>Y</greenStatus>
      <dateStamp>04/14/2008</dateStamp>
      <pinNumber>2</pinNumber>
    </partsRow>
  </orderableParts>
</productsRow>
<productsRow>
  <gpn>1N4148WT</gpn>
  <gpnDescription>Small Signal Diode</gpnDescription>
  <productFamily>Small Signal Diode</productFamily>
  <productFolderLink>/pf/1N/1N4148WT.html</productFolderLink>
  <datasheetLink>/ds/1N/1N4148WT.pdf</datasheetLink>
  <buyLink>/ShoppingExperience/action/displayItems?
gpn=1N4148WT&amp;itemType=BUY</buyLink>
  <sampleLink>/ShoppingExperience/action/displayItems?
gpn=1N4148WT&amp;itemType=SAMPLE</sampleLink>
  <orderableParts>
    <partsRow>
      <opn>1N4148WT</opn>
      <packageId>SOD523F</packageId>
      <partStatus>S</partStatus>
      <greenStatus>Y</greenStatus>
      <dateStamp>03/06/2008</dateStamp>
      <pinNumber></pinNumber>
    </partsRow>
  </orderableParts>
</productsRow>
<productsRow>
  <gpn>1N4448WS</gpn>
  <gpnDescription>Small Signal Diode</gpnDescription>
  <productFamily>Small Signal Diode</productFamily>
  <productFolderLink>/pf/1N/1N4448WS.html</productFolderLink>
  <datasheetLink>/ds/1N/1N4448WS.pdf</datasheetLink>
  <buyLink>/ShoppingExperience/action/displayItems?
gpn=1N4448WS&amp;itemType=BUY</buyLink>
  <sampleLink>/ShoppingExperience/action/displayItems?
gpn=1N4448WS&amp;itemType=SAMPLE</sampleLink>
  <orderableParts>
    <partsRow>
      <opn>1N4448WS</opn>
      <packageId>SOD-323F</packageId>
      <partStatus>S</partStatus>
      <greenStatus>Y</greenStatus>
      <dateStamp>04/14/2008</dateStamp>
      <pinNumber>2</pinNumber>
    </partsRow>
  </orderableParts>
</productsRow>
</products>

-----------------------------------------------------------

Reply via email to