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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:22:45+00:00 2026-06-07T04:22:45+00:00

In order to fix a problem with an ajax request not working in IE,

  • 0

In order to fix a problem with an ajax request not working in IE, I changed my code. Now it’s not working in any browser. The weird part is, that ajax request does gets a proper result. Only this result is not parsed. How to fix this? Do I need to change some headers or so?

all functions are methods in the tbGeocoder object.

 $.ajax({
        url: 'http://nominatim.openstreetmap.org/search',
        type: 'GET',
        dataType: 'jsonp',
        jsonp: 'false',
        jsonpCallback: 'json_callback' + tbGeocoder.requestIndex,
        data: {
            format: 'json',
            q: input,
            limit: 1,
            json_calback: 'json_callback' + tbGeocoder.requestIndex
        },
        beforeSend: function(x) { 
            if (x && x.overrideMimeType) { 
                x.overrideMimeType("application/json;charset=UTF-8"); 
            } 
        },
        dataFilter: function (data, type) {
            console.log(data);
            console.log(type);
          /*for (key in data) {
                //console.log(key);
            }*/
            return data;
        },
        success: tbGeocoder.processRequestResult,

        error: function(data, textStatus, jqXHR) {
            console.log(textStatus);
        }
    });
    tbGeocoder.requestIndex++;
},
preProcessRequestResult: function (data, type) {
    console.log(data);
    console.log(type);
    for (key in data) {
        //console.log(key);
    }
    return data;
},
processRequestResult: function (data) {
    console.log('==>in loop for nominatim');
}

in firebug the console output for a input like input=”Den Dolechh”
is as follows:

code address location
Den Dolech
undefined
jsonp
parsererror
Object { readyState=4, status=200, statusText="success"}

In the network status you can see the headers are like:

 Replyheaders
 Access-Control-Allow-Orig...   *
 Connection close
 Content-Length 445
 Content-Location   search.php
 Content-Type   application/json; charset=UTF-8
 Date   Thu, 05 Jul 2012 10:31:11 GMT
 Server Apache/2.2.14 (Ubuntu)
 TCN    choice
 Vary   negotiate
 X-Powered-By   PHP/5.3.2-1ubuntu4.17

 Requestheaders
 Accept */*
 Accept-Encoding    gzip, deflate
 Accept-Language    nl,en-us;q=0.7,en;q=0.3
 Connection keep-alive
 Host   nominatim.openstreetmap.org
 Referer    http://localhost/locations/add
 User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1

and the reply is:

 [{"place_id":"44757488","licence":"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.","osm_type":"way","osm_id":"36859933","boundingbox":["51.4484252929688","51.449333190918","5.48478031158447","5.48527336120605"],"lat":"51.4489435225293","lon":"5.48514453068994","display_name":"Den Dolech, Eindhoven, Samenwerkingsverband Regio Eindhoven, Noord-Brabant, 5600 MB, Nederland","class":"highway","type":"residential"}]

How do I fix this? I get the data, but how do I get it out?

  • 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-06-07T04:22:47+00:00Added an answer on June 7, 2026 at 4:22 am

    OK, this is very annoying. The answer is a fix for a Typo!

    the line

     json_calback: 'json_callback' + tbGeocoder.requestIndex
    

    should be

    data: {
                format: 'json',
                q: input,
                addressdetails: 1,
                limit: 1,
                json_callback: 'json_callback' + tbGeocoder.requestIndex
            },
    

    Notice the double ´l´ in callback. I also added the addressdetails because that is what I was looking for anyway 😉

    with that I get a proper jsonp resonse:

     json_callback11([{"place_id":"44757488","licence":"Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.","osm_type":"way","osm_id":"36859933","boundingbox":["51.4484252929688","51.449333190918","5.48478031158447","5.48527336120605"],"lat":"51.4489435225293","lon":"5.48514453068994","display_name":"Den Dolech, Eindhoven, Samenwerkingsverband Regio Eindhoven, Noord-Brabant, 5600 MB, Nederland","class":"highway","type":"residential","address":{"road":"Den Dolech","residential":"Eindhoven","suburb":"Eindhoven","city":"Eindhoven","county":"Samenwerkingsverband Regio Eindhoven","state":"Noord-Brabant","postcode":"5600 MB","country":"Nederland","country_code":"nl"}}])
    

    which is processed correctly.
    This is a need trick (to make the json_callback and the jsonp_callback the same…) to fix the same origin problem and differences between browsers. This works in IE9, FF and Chrome on Windows and FF, Chrome and Safiri on Mac.

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

Sidebar

Related Questions

Order by descending is not working on LINQ to Entity In the following Query
I know that snapshot isolation would fix this problem, but I'm wondering if NOLOCK
I'm working on an AJAX-enabled JavaScript frontend that makes calls to a Java backend
I have a problem that I'm not even sure what to search for in
I wrote this in order to fix the problem IE has with select drop
EDIT - I was able to fix this problem using code from 'Farray' with
How to fix this regex in order to get the mentioned outcome ? regex:
in order to recover data from server I use XMLHttpRequest and my code is
This is code I'm using to test a webserver on an embedded product that
I try to use the jQuery Globalization plugin in order to fix the comma

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.