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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:51:18+00:00 2026-06-05T15:51:18+00:00

I have this Javascript function that sends username and password to php file through

  • 0

I have this Javascript function that sends username and password to php file through jquery and then gets a response back to display text and then depending on if it was successful or not, it would display it in either green or red. (Green being successful, red – anything else):

function get() {
            $("#message").hide();
            $.post("login-exec", {
            login: form.login.value,
            password: form.password.value
            },
                function(output) {
                    if($.trim(output) == "Login Successful"){
                        document.getElementById("message").style.color = 'green';
                        $("#message").html(output).fadeIn(2000);
                    }
                    else{
                        document.getElementById("message").style.color = 'red';
                        $("#message").html(output).fadeIn(2000);
                    }

                });
        }

I was wondering if I could do this logic with the style.color on the php file and then just send the output which would have the apropriate green, red and text response already. Like somehow include javascript in the response and then parse it out to run the javascript code as well as the message text.
Is that possible?

  • 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-05T15:51:19+00:00Added an answer on June 5, 2026 at 3:51 pm

    You can change the style color using css, as illustrated in http://jsfiddle.net/TLkMF/ .

    If the PHP returns the json of the variable output in the fiddle, it should do what you want.

    If you want to set the message text as well, then you can do so as illustrated in http://jsfiddle.net/TLkMF/1/

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

Sidebar

Related Questions

i have a function like this in my external javascript file (jQuery is already
I have jQuery Ajax request that sends data to a PHP page that then
I have this simple code that speaks for itself. <script language='javascript"> function check() {}
I have some third-party Javascript that has statements like this: FOO = function() {
Here is the situation. I have some javascript that looks like this: function onSubmit()
So I have this javascript function, it sends an ajax requests to fetch a
I have a Javascript page, that sends data to a PHP page. That data
I have a problem with a javascript set of functions that I made. This
Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
As you may know, when we have this code in Javascript : function getName()

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.