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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:38:52+00:00 2026-06-14T10:38:52+00:00

I’m trying to learn to use jquery deferreds. When using html on jsfiddle, I

  • 0

I’m trying to learn to use jquery deferreds.

When using html on jsfiddle, I get an object returned that when printed in the then() statement, has two lines: “success” and the html that is returned by the ajax request.

So that when I do this:

$(document).on('click', '.ajax', function() {
    $.when(ajax1('<p>first</p>'), 
           ajax2('<p>second</p>'), 
           ajax3('<p>third</p>'))
     .then(function(results1, results2, results3) {
        console.log(results1);
        $('.document').append(results1);
        $('.document').append(results2); 
        $('.document').append(results3);         
        alert('all ajax done');
    });
});

http://jsfiddle.net/loren_hibbard/AsgDz/

I get this in the console:

["<p>first</p>", "success", 
Object
     abort: function ( statusText ) {
     always: function () {
     complete: function () {
     done: function () {
     error: function () {
     fail: function () {
     getAllResponseHeaders: function () {
     getResponseHeader: function ( key ) {
     overrideMimeType: function ( type ) {
     pipe: function ( /* fnDone, fnFail, fnProgress */ ) {
     progress: function () {
     promise: function ( obj ) {
     readyState: 4
     responseText: "<p>first</p>"
     setRequestHeader: function ( name, value ) {
     state: function () {
     status: 200
     statusCode: function ( map ) {
     statusText: "OK"
     success: function () {
     then: function ( /* fnDone, fnFail, fnProgress */ ) {
          __proto__: Object

How can I access just that responseText and avoid the html output with the “success” every other line:

first
success
second
success
third
success

And since I will be more likely using it with JSON data, how do I parse that. Right now, though it returns ‘ajax all complete’ in my then() function, the returned object in the console is a set of three objects. One is the parsed json string, the other is the annoying strting that says ‘success’, and the third is the large object, which contains the responseText which is my unparsed JSON object. How can I access this first object and print my parsed string?
http://jsfiddle.net/loren_hibbard/jtvHf/1/

Thank you!

  • 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-14T10:38:53+00:00Added an answer on June 14, 2026 at 10:38 am

    Simple fix — each result object is an array with three items:

    1. the result data
    2. the status string (“success”)
    3. the JQXHR object.

    So just use results1[0], etc to get the data:

     $('.document').append(results1[0].JSON);
    

    DEMO


    (Note, it looks like there was also a typo in your ajax3 function — the “type” was set to html instead of `post’.)

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.