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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:39:52+00:00 2026-05-24T02:39:52+00:00

My first question so here it goes. My goal is to have a simple

  • 0

My first question so here it goes.

My goal is to have a simple form post and if everything checks out proceed.

$.post("anotherpage.php", $("#form").serialize(),function(data){

if(data == 'sent'){
alert("True:  " + data);
}    else{
alert("False:  " + data);
}

$("#somediv").text(data);

     });   

here is ‘anotherpage.php’

<?php

echo 'sent'; 

?>

Here is my problem, ‘#somediv’ shows the word ‘sent’ but my function fails every time. Also when it does fail when it alerts it looks like this. “False: s…” It makes me think I have some problem up the stream that is effecting this but I don’t know what.

  • 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-24T02:39:53+00:00Added an answer on May 24, 2026 at 2:39 am

    When trying to be explicit with your HTTP response, it’s easy to accidentally return extra whitespace, especially at the end of your PHP block (carriage returns after the closing angle-bracket being the usual suspects).

    Some tips:

    1. Make sure there is no whitespace before the start of your php block.
    2. Explicitly end the response with exit() on the last code line of your php block:

    e.g.

      <?php
    
      echo 'sent';
      exit(); 
    
      ?>
    

    There are a few cool functions in PHP regarding output control. You can buffer the output, clear it, store it or flush it. See here for more information.

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

Sidebar

Related Questions

I'm not entirely sure how to post this question, but here goes... I have
Ok, first question so here goes, A function that runs on activation of a
my first question here! I have a problem with a piece of code that
so here goes my first real coding question ever on the web since normally
This is my first question on here so here goes.... I've got an issue
Here goes my first question. First of all I'm new with Java and still
I have one more question(first one is here: html, css with center div problem
Bit of an open-ended question here, so I'll outline the problem first. We have
First question, here goes nothing... I'm trying to add a new entry to my
this is my first question to stackoverflow so here it goes... I use cruise

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.