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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:45:43+00:00 2026-06-10T18:45:43+00:00

I got a silly error that I don’t know why is happening. Basically i

  • 0

I got a silly error that I don’t know why is happening.

Basically i get the return from the AJAX code “The table PAGES exists” and I can output that to the <p> tag if I put it after declaring var response = data; but somehow it won’t output anything when is inside the IF statement inside the functionResponse.

Can anyone tell me why? Am I passing the variable wrong?

   $(document).ready(function(){


        function functionResponse (response){

            if (response == "The table PAGES exists"){
                $("p").html(response);



            } 
            } // close of functionResponse      

$("#iForm").submit( function(event){
    event.preventDefault();

    var user = $("input[name=username]").val();
    var password = $("input[name=password]").val();
    var dbName = $("input[name=dbName]").val();
    var server = $("input[name=server]").val(); 


        $.get("1.php", {username: user, password: password, dbName: dbName, server: server },function(data){

            var response = data;            



            functionResponse (response);

                        }) // close of .get


    })

})
  • 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-10T18:45:44+00:00Added an answer on June 10, 2026 at 6:45 pm

    Since trimming worked at my suggestion I’m entering it as an answer with the following explanation.

    the return handler for your get function was able to assign the value to the p tag because assigning doesn’t care about white space, especially assigning html, the browser just ignores all that extra blank space.

    It’s not passing it to a function that made it break, it was the string comparison. The browser may not care about white space in the HTML, but JavaScript cares a whole lot about white space when doing a string comparison.

    The text

    "This is some text"
    

    and

    "    This is some text    "
    

    will appear the same when the browser renders them, as repeated spaces are ignored. But just by looking at them you can see that they are not the same string. Javascript will not ignore the white space that leads and trails your sting unless you tell it to by trimming it.

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

Sidebar

Related Questions

Got a seg fault from my memcpy that gdb can't give me anything else
Hi i know it's silly but true i got this when i edit any
I've got an initializer method that does a silly thing. I need to optimize
I have little knowledge with the iPhone SKD (don't even know what code it
Got a strange one and I know it is something silly but I can't
I've got silly magic problem in rails! So, I've created table with foreign key
I have some code that throws a potential error and I catch these, then
Time for another silly question :) I got some tables in a xhtml-document with
I'm hoping this is something silly I've done. I got a function unigref near
I'm stuck with this pretty silly thing; I got a textfile like this; Hello::140.0::Bye

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.