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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:45:34+00:00 2026-05-14T06:45:34+00:00

I use this pseudo-class to make Ajax request to server: function RequestManager(url, params, success,

  • 0

I use this pseudo-class to make Ajax request to server:

function RequestManager(url, params, success, error){
    //Save this Ajax configuration
    this._ajaxCall = null;
    this._url= url;
    this._type = params.type;
    this._success = function(){
        alert("ok");
    };
    this._error = function(){
        alert("ko");
    };
}

RequestManager.prototype = {
    require : function(text){
        var self = this;
        this._ajaxCall = $.ajax({
            url: this._url,
            type: this._type,
            data: text,
            success: function(xmlResponse){
                var responseArray = [];
                var response = _extractElements(xmlResponse, arrayResponse);
                self._success(response);
            },
            error: self._error,
            complete : function(xhr, statusText){
                alert(xhr.status);
                return null;
            }
        });
    }

This is PHP that will be loaded:

<?php
    header('Content-type: text/xml');

    //Do something
    $done = true;

    $response = buildXML($done);
    $xmlString = $response->saveXML();
    echo $xmlString;

    function buildXML ($done){
        $response = new SimpleXMLElement("<response></response>");
        if($done){
            $response->addChild('outcome','ok');
        }
        else {
            $response->addChild('outcome', 'ko');
        }
        return $response;
    }

When I instantiate a new object, and I use it to load a request, it always return to me error, and status code is 0. The server correctly generates an XML document. Why I can’t get a correct 200 code back?

  • 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-14T06:45:34+00:00Added an answer on May 14, 2026 at 6:45 am

    If this happens on your second call to require, it’s because the call to abort() results in your callback being called with a status code of 0. You should later get the correct result for the second request.

    In jQuery 1.4 there’s also a bug where your success callback is called after an aborted request. See my answer to Request periodically coming back empty under race conditions.

    Unrelated to this issue, there are variables in your code (timer and ajaxCall) that seem to be referenced both with and without a leading underscore.

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

Sidebar

Ask A Question

Stats

  • Questions 385k
  • Answers 385k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If your other team members don't have access to Xcode… May 14, 2026 at 11:22 pm
  • Editorial Team
    Editorial Team added an answer There are so many things your forgot to document: what… May 14, 2026 at 11:22 pm
  • Editorial Team
    Editorial Team added an answer The IEnumerable<T> and IEnumerable interfaces are used to generate a… May 14, 2026 at 11:22 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.