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 4250358
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:31:05+00:00 2026-05-21T04:31:05+00:00

I really hope someone can help me with this. Basically i have an issue

  • 0

I really hope someone can help me with this. Basically i have an issue with an ajax-call in jQuery in ie7. The script work in every other browser than ie7.

The ajax always return error in ie7.

The code:

<script type="text/javascript">

$(document).ready(function()
{

//Run Ajax on Click
$('#GlsSubmit').click(function(){

//Get input from textfields
street = $("#GlsStreet").val(); 
zip = $("#GlsZip").val();

//How many results to show
amount = '5';
var time = new Date;

//Initiate Ajax (fetch xml-data from .asp in applications folder)
  $.ajax({
    url: "http://www.test.dk/gls.aspx?street="+street+"&zip="+zip+"&amount="+amount+"&dummy="+ time.getTime(),
    success: function(msg){

        //Saving Shop data
        CompanyName = $(msg).find("PakkeshopData").html();
        $('#GlsResults').html('');
        $(msg).find("PakkeshopData").each(function(index){

            CompanyName = $(this).find('CompanyName').text();
            CompanyStreetName = $(this).find('StreetName').text();
            CompanyZipCode = $(this).find('ZipCode').text();
            CompanyCityName = $(this).find('CityName').text();
            CompanyID = $(this).find('Number').text();
            $('#GlsResults').append("<input type='radio' class='required' name='shopSelecter' id='shopSelecter"+index+"' value='"+CompanyID+"'/><label for='shopSelecter"+index+"'>"+ CompanyName +", "+CompanyStreetName+", " + CompanyZipCode + " "+ CompanyCityName +"</label><div class='clear'></div>");

        }); //End of each

        //See if user choses another shop
        $('#GlsResults input[type=radio]').change(function(){
            shopid = $(this).val();
             $.ajax({
                url: "http://www.test.dk/gls2.aspx?ParcelShopNumber="+shopid,
                success: function(data){

                        //Save oinfo for the chosen shop
                        CompanyNameSingle = $(data).find('CompanyName').text();
                        CompanyStreetNameSingle = $(data).find('StreetName').text();
                        CompanyZipCodeSingle = $(data).find('ZipCode').text();
                        CompanyCityNameSingle = $(data).find('CityName').text();
                        CompanyIDSingle = $(data).find('StreetName2').text();

                        //Change values for input fields
                        $('#EcomOrderDeliveryAddress2').val(CompanyIDSingle);
                        $('#EcomOrderDeliveryName').val(CompanyNameSingle);
                        $('#EcomOrderDeliveryAddress').val(CompanyStreetNameSingle);
                        $('#EcomOrderDeliveryZip').val(CompanyZipCodeSingle);
                        $('#EcomOrderDeliveryCity').val(CompanyCityNameSingle);

                }, //End of succes

                error:function(response){

                } //End of error

            }); // End of ajax

        }); // End of radio button change

        $("#gls-error").hide();

   }, //End of succes
     error:function(response){
     //Error Messages
     if( zip == ''){
        $("#GlsResults").html("<div id='gls-error'>Indtast venligst et postnummer</div>");
     }

     else if( !(zip.length == 4)){
        $("#GlsResults").html("<div id='gls-error'>Indtast venligst et postnummer på 4 cifre</div>");
     }

     else{
        $("#GlsResults").html("<div id='gls-error'>Kunne ikke finde et pakkecenter</div>");
        }
    } //End of error
  }); // End of ajax
  }); //End of click



}); //End of document.ready


</script>

Anyone got any ideas :-)?

Thanks!

  • 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-21T04:31:06+00:00Added an answer on May 21, 2026 at 4:31 am

    Anyone got any ideas

    Yes: Break that up into smaller pieces. That kind of deep nesting is very hard to read, maintain, and troubleshoot. 🙂

    Without your having said what error, here are some other observations which may help you get going on it:

    1. If the page that this script is running in isn’t on http://www.fricykler.dk, that’s your problem. You’re running into the Same Origin Policy.
    2. If it is on http://www.fricykler.dk, remove that from the ajax calls (just use url: '/gls.aspx...').
    3. Unless you’re declaring street, zip, and others in code you haven’t quoted, you’re falling prey to the Horror of Implicit Globals. Recommend declaring them. Who knows, maybe you’re overwriting something important, since the window namespace gets very cluttered on IE.
    4. Walk through the code, step-by-step, in a debugger. You can use the free edition of Visual Studio.Net to debug client-side code in IE7. (In general, here in 2011 there’s no excuse not to use a debugger for your client-side work.)

    Other observations that almost certainly are not the problem:

    • Every time you call $(), it has to do several function calls, a memory allocation, and if you’re passing it a selector (even an ID selector), it has to do a DOM query. So whenever you find yourself repeating it (CompanyName = $(this).find('CompanyName').text();, CompanyStreetName = $(this).find('StreetName').text();, …). Consider doing it once and remembering the result (var $this = $(this); then CompanyName = $this.find('CompanyName').text();, etc.)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really hope someone can help with this problem. I have an ajax pagination
I really hope someone can help on this because I'm learning cocoa and have
I have a really hard time understanding routes and I hope someone can help
Really hope someone can help me as I'm a bit stuck :S I have
This is really bugging me, so I hope someone can help me a bit
I really hope someone can help me with this. I'm struggling with it for
I really hope someone here can help out with this. I'm using Magento 1.6.1.0
I'm driving myself nuts with this particular problem, i really hope someone can help!
Hi guys I hope someone can help me with this I´m really stuck although
OK I have a weird little issue I hope someone can help me with.

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.