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

  • SEARCH
  • Home
  • 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 6682989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:46:10+00:00 2026-05-26T04:46:10+00:00

Hi there I am having a problem with an ajax script in IE, it

  • 0

Hi there I am having a problem with an ajax script in IE, it seems to work fine in all other browsers. I am trying to re-write a drop down list to display a different price range depending on whether a user is looking to rent or looking to buy, here is how I’ve tackled it

function in header section:

<script type="text/javascript">
function showPrice(str)
{
    if (str=="")
    {
        document.getElementById("txtHint").innerHTML="";
        return;
    } 

    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
            document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
    }

    xmlhttp.open("GET","getprice.php?q="+str,true);
    xmlhttp.send();
}
</script>

This is the HTML code that makes the table:

<table>
<form method="GET" action="search_results.php">
<tr>
    <td>
        <select name="type" style="width:120px">
            <option selected="selected" value="residential">residential</option>
            <option value="commercial">commercial</option>
            <option value="business">business</option>
            <option value="student">student &amp; sharers</option>
        </select>
    </td>
    <td>
        <select name="offered" style="width:120px" onchange="showPrice(this.value)">
            <option selected="selected" value="for_sale">for sale</option>
            <option value="to_let">to let</option>
        </select>
    </td>
    <td>
        <select name="area"  style="width:120px">
            <option selected="selected" value="any">any area</option>
            <?php 
                $sql="select * from areas;";
                $result=mysql_query($sql);

                while($data=mysql_fetch_array($result))
                {
                    $area=$data['area'];
                    echo "<option value='$area'>$area</option>";
                }
            ?>
        </select>
    </td>
</tr>
<tr id="txtHint">
    <td>
        <select name='minprice' style="width:120px">
            <option selected='selected' value=''>min price</option>
            <option value='50000'>&pound;50,000</option>
            <option value='75000'>&pound;75,000</option>
            <option value='100000'>&pound;100,000</option>
            <option value='125000'>&pound;125,000</option>
            <option value='150000'>&pound;150,000</option>
            <option value='175000'>&pound;175,000</option>
            <option value='200000'>&pound;200,000</option>
            <option value='250000'>&pound;250,000</option>
            <option value='300000'>&pound;300,000</option>
            <option value='400000'>&pound;400,000</option>
            <option value='500000'>&pound;500,000</option>
            <option value='750000'>&pound;750,000</option>
            <option value='1000000'>&pound;1,000,000</option>
            <option value='1500000'>&pound;1,500,000</option>
        </select>
    </td>
    <td>
        <select name='maxprice' style="width:120px">
            <option selected='selected' value=''>max price</option>
            <option value='50000'>&pound;50,000</option>
            <option value='75000'>&pound;75,000</option>
            <option value='100000'>&pound;100,000</option>
            <option value='125000'>&pound;125,000</option>
            <option value='150000'>&pound;150,000</option>
            <option value='175000'>&pound;175,000</option>
            <option value='200000'>&pound;200,000</option>
            <option value='250000'>&pound;250,000</option>
            <option value='300000'>&pound;300,000</option>
            <option value='400000'>&pound;400,000</option>
            <option value='500000'>&pound;500,000</option>
            <option value='750000'>&pound;750,000</option>
            <option value='1000000'>&pound;1,000,000</option>
            <option value='1500000'>&pound;1,500,000</option>
        </select>
    </td>
    <td>
        <select name="bedrooms" style="width:120px">
            <option selected="selected" value="">Bedrooms</option>
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5 or more</option>
        </select>
    </td>
</tr>
</form>
</table>

and this is the php file that decides whether to echo the lover price rang or rhe upper price range:

<?php
$q=$_GET["q"];

if($q=="to_let")
{
<td>
    <select name='minprice' style='width:120px'>
        <option selected='selected' value=''>min price</option>
        <option value='250'>&pound;250</option>
        <option value='500'>&pound;500</option>
        <option value='750'>&pound;750</option>
        <option value='1000'>&pound;1000</option>
        <option value='1250'>&pound;1250</option>
        <option value='1500'>&pound;1500</option>
        <option value='2000'>&pound;2000</option>
    </select>
</td>
<td>
    <select name='maxprice' style='width:120px'>
        <option selected='selected' value=''>max price</option>
        <option value='250'>&pound;250</option>
        <option value='500'>&pound;500</option>
        <option value='750'>&pound;750</option>
        <option value='1000'>&pound;1000</option>
        <option value='1250'>&pound;1250</option>
        <option value='1500'>&pound;1500</option>
        <option value='2000'>&pound;2000</option>
    </select>
</td>
<td>
    <select name='bedrooms' style='width:120px'>
        <option selected='selected' value=''>Bedrooms</option>
        <option value='1'>1</option>
        <option value='2'>2</option>
        <option value='3'>3</option>
        <option value='4'>4</option>
        <option value='5'>5 or more</option>
    </select>
</td>
PRICE;
}
else
{
    $my_string = <<<PRICE
    <td>
        <select name='minprice' style='width:120px'>
            <option selected='selected' value=''>minimum price</option>
            <option value='50000'>&pound;50,000</option>
            <option value='75000'>&pound;75,000</option>
            <option value='100000'>&pound;100,000</option>
            <option value='125000'>&pound;125,000</option>
            <option value='150000'>&pound;150,000</option>
            <option value='175000'>&pound;175,000</option>
            <option value='200000'>&pound;200,000</option>
            <option value='250000'>&pound;250,000</option>
            <option value='300000'>&pound;300,000</option>
            <option value='400000'>&pound;400,000</option>
            <option value='500000'>&pound;500,000</option>
            <option value='750000'>&pound;750,000</option>
            <option value='1000000'>&pound;1,000,000</option>
            <option value='1500000'>&pound;1,500,000</option>
    </select>
</td>
<td>
    <select name='maxprice' style='width:120px'>
        <option selected='selected' value=''>maximum price</option>
        <option value='50000'>&pound;50,000</option>
        <option value='75000'>&pound;75,000</option>
        <option value='100000'>&pound;100,000</option>
        <option value='125000'>&pound;125,000</option>
        <option value='150000'>&pound;150,000</option>
        <option value='175000'>&pound;175,000</option>
        <option value='200000'>&pound;200,000</option>
        <option value='250000'>&pound;250,000</option>
        <option value='300000'>&pound;300,000</option>
        <option value='400000'>&pound;400,000</option>
        <option value='500000'>&pound;500,000</option>
        <option value='750000'>&pound;750,000</option>
        <option value='1000000'>&pound;1,000,000</option>
        <option value='1500000'>&pound;1,500,000</option>
    </select>
</td>
<td>
    <select name='bedrooms' style='width:120px'>
        <option selected='selected' value=''>Bedrooms</option>
        <option value='1'>1</option>
        <option value='2'>2</option>
        <option value='3'>3</option>
        <option value='4'>4</option>
        <option value='5'>5 or more</option>
    </select>
</td>

PRICE;
}

echo $my_string;
?>

This seems to work really well in FF, Safari and Chrome just not in IE, I have seen similar problems but nothing that could solve this specific problem.

Any help or advice on this would be greatly appreciated.

  • 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-26T04:46:10+00:00Added an answer on May 26, 2026 at 4:46 am

    Promoting comment to answer:

    I suggest you load both sets and switch between them by hiding or displaying:

    window.onload=function() {
      showPrice('for_sale'); // or do this in CSS
    }
    function showPrice(letOrSale) { 
      var forSale = letOrSale==="for_sale";
      document.getElementById('forLetId').style.display=forSale?"none":"";
      document.getElementById('forSaleId').style.display=forSale?"":"none"; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a serious problem with my ASP.NET AJAX application. There is a javascript
I'm having a problem with an ajax script that checks postcodes against a region
I am having a strange problem. There are two ajax calls in the code.
I'm having a problem with my compiler telling me there is an 'undefined reference
I'm having a problem using UpdateModel(theModelToUpdate) causing concurrency issues. Basically whats happening is, there
After having solved the problem of getting the editor to launch when there's a
I'm having trouble with Web Start. There is no problem if I start the
I'm having some issues with a jQuery AJAX call. My code works fine when
I'm having a problem similar to jQuery $.ajax Not Working in IE8 but it
I am using the ASP.NET AJAX Control Kit and I am having a problem

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.