below example is working in FF but not working in IE. Pls somebody
help me.

//xml file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<Incentives>
<incentive incentiveID="288061" name="FWD 4dr I4" notes="Gas I4 2.3L"/
>
<incentive incentiveID="288062" name="FWD 4dr I4" notes="Gas I4 2.3L"/
>
</Incentives>
//js file
// File: readXML.js

// Start function when DOM has completely loaded
$(document).ready(function(){

        // Open the students.xml file

        $.get("incentives.xml",{},function(xml){

                // Build an HTML string
                myHTMLOutput = '';
                myHTMLOutput += '<table width="98%" border="1" cellpadding="0"
cellspacing="0">';
                myHTMLOutput += 
'<th>incentiveID</th><th>name</th><th>notes</th>';

                // Run the function for each student tag in the XML file

                $(xml).find('Incentive').each(function(){

                        var $Incentive = $(this);


                        var incentiveID = $Incentive.attr("incentiveID");
                        var name = $Incentive.attr("name");
                        var notes = $Incentive.attr("notes");



                        // Build row HTML data and store in string
                        mydata = BuildStudentHTML(incentiveID,name,notes);
                        myHTMLOutput = myHTMLOutput + mydata;
                });
                myHTMLOutput += '</table>';

                // Update the DIV called Content Area with the HTML string
                                alert(mydata);
                $("#ContentArea").append(myHTMLOutput);
        });
});



 function BuildStudentHTML(incentiveID,name,notes){

        // Check to see if their is a "post" attribute in the name field


        // Build HTML string and return
        output = '';
        output += '<tr>';
        output += '<td>'+ incentiveID +  '</td>';
        output += '<td>'+ name +'</td>';
        output += '<td>'+ notes +'</td>';
        output += '</tr>';
        return output;
}
         // JavaScript Document// JavaScript Document

// html file
<html>
        <head>
                <title>JQuery Easy XML Read Example</title>
                <script type="text/javascript" src="jquery.js"></script>
                <script type="text/javascript" src="test-incentive.js"></script>
        </head>
        <body>
        <div id="ContentArea"></div>
        </body>
</html>

Reply via email to