dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: JQuery AJAX not working with FF -- works fine with Chrome and IE

  1. #1
    Join Date
    Jan 2009
    Posts
    5

    JQuery AJAX not working with FF -- works fine with Chrome and IE

    As the subject line says it works fine in IE and Chrome..
    but nothing happens in Firefox.
    From my testing the problem seems to be occuring
    when using jquery to open the xml feed.
    (I have not edited jquery at all and I'm using version 1.2.6)


    Here's my code.
    // File: readXML.js

    // Start function when DOM has completely loaded


    function XMLSummary(xml_feed, title)
    {

    var topic_header_flag
    var topic_content_flag




    $(document).ready(function(){

    // Open the xml feed


    $.get(xml_feed,{},function(xml){

    // Build an HTML string
    myHTMLOutput = '';
    myHTMLOutput += '<table width="98%" border="0" cellpadding="2" cellspacing="2">';

    myHTMLOutput += '<th>' + title.toUpperCase() + '</th>';



    // Run the function for each topic tag in the XML file
    $('topic',xml).each(function(i) {
    summary_e = $(this).find("summary").attr("Identity");
    topic_header_e = $(this).find("topic_header_e").text();
    topic_content_e = $(this).find("topic_content_e").text();
    doc_name_e = $(this).find("doc_name_e").text();
    doc_filename_e = $(this).find("doc_filename_e").text();

    //try setting a flag for topic header



    is_javascript = doc_filename_e.indexOf("javascr",0);
    is_http = doc_filename_e.indexOf("http",0);

    // IF filename is a local link then replace filename with self referencing javascript call
    if (is_javascript == 0)
    {

    //need to pull doc_name and the summary_id and replace the function name and send these to it.
    //needs to look like this javascript:XMLSummary('xml_files/data2.xml','Mission Verbs')
    //the summary_id eg in this case '2' should match up with the xml file number

    doc_filename_e = doc_filename_e.replace(/javascript:showSummaryData/,"");

    /////// remove left bracket brackets that follow data and proceed .xml

    doc_filename_e = doc_filename_e.replace(/[(]/g,"");

    /////// remove right bracket brackets that follow data and proceed .xml

    doc_filename_e = doc_filename_e.replace(/[)]/g,"");

    //////add directory and filetype suffix.
    doc_filename_e = "javascript:XMLSummary('xml_files/data" + doc_filename_e + ".xml','" + doc_name_e + "')";

    }

    ///////////if document is an outside link
    else if (is_http == 0)

    {
    doc_filename_e = doc_filename_e
    }

    //else append the SOH_content directory to front of filename.
    else
    {
    doc_filename_e = 'SOH_Content/' + doc_filename_e
    }

    // Build row HTML data and store in string

    mydata = BuildSummaryHTML(topic_header_e,topic_content_e, doc_name_e, doc_filename_e);
    myHTMLOutput = myHTMLOutput + mydata;


    //too ensure no header repeats -- is a global variable
    topic_header_flag = topic_header_e
    topic_content_flag = topic_content_e

    });
    myHTMLOutput += '</table>';

    // Update the DIV called Content Area with the HTML string
    $("#txtSummary").html(myHTMLOutput);
    });
    });



    function BuildSummaryHTML(topic_header_e, topic_content_e, doc_name_e, doc_filename_e){


    // Build HTML string and return
    output = '';

    // check to see that we are not repeating the Header if it is then leave blank
    if (topic_header_flag == topic_header_e)
    {
    topic_header_e = "";
    }

    if (topic_content_flag == topic_content_e)
    {
    topic_content_e = "";
    }


    //output += '<tr><td>'+ topic_header_e + '</td></tr>';
    output += '<tr><td><BR><B>'+ topic_header_e + '</B></td></tr>';
    output += '<tr><td>'+ topic_content_e + '</td></tr>';

    is_javascript = doc_filename_e.indexOf("javascr",0);
    is_http = doc_filename_e.indexOf("http",0);


    // IF filename is a local link then replace filename with self referencing javascript call
    if (is_javascript == 0 )
    {

    output += '<tr><td><a href="'+ doc_filename_e + '">' + doc_name_e + '</a></td></tr>';
    }

    // If filename is a document or an outside link than open in new window
    else
    {
    output += '<tr><td><a href="'+ doc_filename_e + '"target="_blank">' + doc_name_e + '</a></td></tr>';
    }



    //output += '<BR>';
    return output;



    }


    }

  2. #2
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,774

  3. #3
    Join Date
    Mar 2007
    Posts
    946
    Quote Originally Posted by toicontien View Post
    In Firefox, Click Tools, then select "Error Console" and give us the JavaScript error you are encountering.
    Or install firebug on firefox and it will show you the errors as well

  4. #4
    Join Date
    Jan 2009
    Posts
    5
    firebug wasn't showing anything..that I could tell.
    but the error console tells me that
    XMLSummary is not defined.

    here's the html that I use to call the script.

    <li><a href="javascript:XMLSummary('xml_files/data4.xml','Estimate')">Estimate</a></li>



    ps.

    thanks for your help.

  5. #5
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    Can you attach or link to the real page?
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  6. #6
    Join Date
    Jan 2009
    Posts
    5

    thanks,,, the script is attached

    Still not sure why it's not working .
    In another thread It was suggested that
    xml request object needed something added to it.
    http://www.webdeveloper.com/forum/sh...d.php?t=179932

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles