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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:54:22+00:00 2026-06-17T14:54:22+00:00

Im seeing some very odd stuff in a simple ajax/jquery code I wrote and

  • 0

Im seeing some very odd stuff in a simple ajax/jquery code I wrote and I can’t explain why Im seeing what Im seeing.

I have a php file called complete.php, the only thing this does at the moment is:

echo "saved";

I have a jquery ajax call, which has a .done() function, which looks like this:

jQuery.ajax({
        type: "POST",
        url: "complete.php",
        data: "id=someIdHere",
        }).done(function(d){

         alert(d);

          if(d == "saved"){
                alert('loading done');
          }else{
                alert('error');
          }
    });

My firebug confirms the response from the complete.php is ‘saved’.

when I typeof the ‘d’ response, it is of type ‘string’,

however for some reason, the alert I get in the .done() function, is ‘error’ and not ‘loading done’.

the ‘alert(d)’ just before the if statement gives ‘saved’.

What am I missing here?

  • 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-17T14:54:23+00:00Added an answer on June 17, 2026 at 2:54 pm

    Very odd but Iv found the issue.

    my php was

    echo "saved";
    

    which is right, however when I debugged the return as per @mplungjan suggestion, the return was ” saved” (with white space) this was odd as the php had no white space, I then changed the php to

    echo trim("saved");

    but when I again debugged the return, it again was ” saved” (with the white space)

    No idea why the white space is being applied, but I have resolved it by replacing the white space in the return / .done() function

    I wont select this as the answer, but if anyone knows hoe the white space could have been added Id love to know.

    Im using firefox 18 on mountain lion

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

Sidebar

Related Questions

So I am seeing some very strange functionality in my app. I have a
I'm working on some VB.net code that I inherited and am seeing some very
I'm seeing some very odd behaviour in my AngularJS app. When a single $broadcast
Seeing some strange things; help is being solicited. I have a query, like so:
I'm seeing some weird stuff happening in my app. After coming back to the
I have a third party component I'm using and I'm seeing some issues with
I have this problem in my ASP.NET application where I'm seeing some of my
I'm using MVC3 .NET4.0 (VB), and I'm seeing some strange behavior on a simple
I'm seeing some very strange behaviour from the Apple Push Notification Servers when the
I know this is very newbyish but I have been using php.net for refernce

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.