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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:09:36+00:00 2026-05-13T20:09:36+00:00

I am trying to communicate with Google’s spell check service using jQuery. Google’s service

  • 0

I am trying to communicate with Google’s spell check service using jQuery. Google’s service requires that you post XML and it will in turn return an XML response. In IE, the success callback gets hit every time, but in non-IE browsers (tested in Firefox and Chrome) the error callback is getting hit every time.

The biggest difference is in how the XML that is posted is created. For IE, an ActiveX object is getting created; for all other browsers the DOMParser is used (example from w3schools).

Below is my test code (NOTE: ‘spell-check’ represents the ID of an HTML button.) What am I missing or need to change to successfully post XML from jQuery across browsers?

<script type="text/javascript">

var xmlString = '<?xml version="1.0"?><spellrequest><text>mispell</text></spellrequest>';

function createXMLDocument(s) {
    var xmlDoc;
    if (window.DOMParser) {
        var parser = new DOMParser();
        xmlDoc = parser.parseFromString(s, 'text/xml');
    } else {
        xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
        xmlDoc.async = 'false';
        xmlDoc.loadXML(s);
    }
    return xmlDoc;
}

$(function() {
    $('#spell-check').live('click', function(e) {
        e.preventDefault();
        $.ajax({
            cache: false,
            contentType: 'text/xml',
            data: createXMLDocument(xmlString),
            dataType: 'xml',
            processData: false,
            type: 'POST',
            url: 'https://www.google.com/tbproxy/spell?lang=en',
            success: function(data, textStatus, XMLHttpRequest) {
                alert(textStatus);
                //debugger;
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(textStatus);
                //debugger;
            }
        });
    });
});

  • 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-13T20:09:36+00:00Added an answer on May 13, 2026 at 8:09 pm

    The dom Parser chokes on the <?xml version="1.0"?> part..
    Remove it and it should work fine ..

    [edit]

    Now that we fixed the parser failing, lets look at the ajax call..

    You need to convert the xml object to a string before sending it through a POST..
    This means that you should send directly the xmlstring without parsing it first (if there is nothing else you need to do with the xml).. remember to escape it first..

    change data: createXMLDocument(xmlString), to data: escape(xmlString), and try once more ..

    [edit 2]

    Just noticed… you cannot make ajax calls crossdomain (it is not safe) unless they are JSONP .. you can only talk with your own domain .. the workaround is to make a server-side page (asp/php etc..) that will make the crossdomain call and return the results to your own javascript call..

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

Sidebar

Related Questions

I am trying to communicate with RIA service from extjs using POST for getting
I have an applet that throws this exception when trying to communicate with the
I am trying to access google calendar from php program. I am using a
We are trying to communicate with a remote API which requires JSON formatted data.
I'm trying to communicate with a third party server using curl. The authentication system
I am trying to communicate with a RESTful service in Rails. It can return
I'm trying to communicate between my PC (Windows 7 using Netbeans and RXTX) with
I've been trying to communicate with a program (smbpasswd) using Python's subprocess module without
I am trying to communicate/update UI from Service to activity. The broadcast I receive
I'm trying to communicate with u rban airship API using a ROR web application.

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.