Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4320794
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:40:21+00:00 2026-05-21T08:40:21+00:00

I have two web pages; Foo.aspx and Bar.aspx. Bar.aspx uses jQuery.ajax() to request a

  • 0

I have two web pages; “Foo.aspx” and “Bar.aspx”. Bar.aspx uses jQuery.ajax() to request a string of data from Foo.aspx. Foo.aspx returns nothing more than

<SerialNumber>12345-ABC</SerialNumber>

Upon a successful return, Bar.aspx will use .find() to display

12345-ABC

Here’s example code (simplified) to makes things clearer:

Bar.aspx

<script type='text/javascript'>
    $(document).ready(function () { 
        getData();    
    });

    function getData() {
        $.ajax({ 
            url: '/Foo.aspx', 
            dataType: 'xml', 
            cache: false, 
            data: {cmd: 'sn'}   
        })
        .success(parseData)
        .error(displayError);  
    }

    function parseData(data) { 
        var sn = $(data).find('SerialNumber').text(); 
        $('#serialNumber').text(sn); 
        window.setTimeout(getData, 1000);  
    }

    function displayError(error) { 
        $('#error').text('Error occurred getting data');  
    }
</script>
<div>
    <label>Serial Number:</label> 
    <label id='serialNumber'></label> 
</div>
<div id='error'></div>

Foo.aspx

public void Page_Load(object sender, EventArgs e)
{
    string response = string.Empty;
    if (Request.QueryString["cmd"] != null)
    {
        switch (Request.QueryString["cmd"])
        {
            case "sn":
                response = "<SerialNumber>12345-ABC</SerialNumber>";
                break;
         }
    }

    Response.Write(response);
    Response.Flush();
}

The $.ajax() call works consistently without any problems. However, depending on what I specify as the dataType: AND depending on what browser type I use (Chrome, Firefox, or IE), the .find() method will or will not work. More specifically, the data 12345-ABC does not get displayed in the browser.

It’s probably important to note that I used Fiddler2 to watch the data come back from Foo.aspx, and the <SerialNumber>12345-ABC</SerialNumber> string is, in fact, returning back to Bar.aspx. In other words, I know that the data is there for the .find() to parse.

Breaking down the dataType and browser results, here’s what I have found:

When dataType = "text or html or script or excluded" – Chrome and Firefox successfully display the serial number. IE, on the other hand, fails to display the serial number.

When dataType = "xml" – IE successfully displays the serial number, but Chrome and Firefox fail to do so.

Why does the dataType affect the way .find() works (or doesn’t) and, more importantly, what can I do to get .find() to work in Chrome/FF/IE without having to run different code based on the browser type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:40:21+00:00Added an answer on May 21, 2026 at 8:40 am

    I suspect that you’re having tag case issues. Can you arrange to have the XML come back with lower case tags?

    <serialnumber>12345-ABC</serialnumber>
    

    And then you’d do this in parseData:

    var sn = $(data).find('serialnumber').text();
    

    If you can’t change the XML, then try changing just parseData.

    Tags in HTML are supposed to be case insensitive but in XML they’re case sensitive. I generally side step the whole case problem by putting all tags in lower case so that I don’t have to deal with browser, parser, or context confusion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two pages, the parent and from this page I am using: window.open('OrderDetailsFull.aspx?ObjectID='
We have some web pages which have two frames, with one frame in the
I have two web applications in the same server like this: /basedir/app1path/default1.aspx /basedir/app2path/default2.aspx How
I have a simple web site with two pages. One displays a list of
I have two web pages: one consists of four asp.net text boxes and one
I have two web applications running in the same Tomcat Instance. In one of
I have two web applications and both are developed in ASP.NET. Now I want
I have two medium-sized web applications that I'm merging into one. They are both
Suppose you have two seperate ASP.NET Web Application projects that both need to use
I currently have an asp.net website hosted on two web servers that sit behind

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.