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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:06:15+00:00 2026-06-03T04:06:15+00:00

I am having a problem with a simple callback function in jQuery ajax. Google

  • 0

I am having a problem with a simple callback function in jQuery ajax. Google won’t help and stack overflow wouldn’t either, so I guess this might not be something specific but rather something I am too ignorant to see. To me the code looks exactly like it should.

So, here’s the code:

function sendMessage(message)
{
//Establish connection to php script
$.ajax({
    type: 'POST',
    url: 'action/chat/test.php',
    success: function(feedback){

        alert(feedback);

    }
}).error(function(){
    //Do some error handling here
});
}

In test.php it simply says

<?php
    echo "called";
?>

As far as I am concerned “called” should be alerted – but it isn’t.
I have checked already that the function sendMessage() is called (and the parameter message doesn’t matter for now).

Does anyone have any idea?

  • 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-03T04:06:16+00:00Added an answer on June 3, 2026 at 4:06 am

    Update: One thing to note also, make sure you use some kind of debugger like firebug. Then you can go to the network tab and look at the request url and response manually to see if its getting a 200 response or internal server error, etc.

    Try adding a console.log(data); in your success function to see if anything is being returned.

    You could also use .always(data):

    function sendMessage(message)
    {
      //Establish connection to php script
      $.ajax({
          type: 'POST',
          url: 'action/chat/test.php'   
      }).done(function(data) { console.log(data); })
        .fail(function() { alert("error"); })
        .always(function() { alert("complete"); });
    }
    

    From the docs:

    Deprecation Notice: The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks
    will be deprecated in jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

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

Sidebar

Related Questions

i am having some simple problem in objective c maybe you can help .
I started trying to write chrome extension and I'm having problem with simple function:
I'm having a problem getting a simple ASP.NET webpage to display. The page contains
I'm having a problem with a simple form where i'm attempting to fire an
Ok, so I'm having a problem with a simple textarea. I'm using a kind
I'm having a problem with a pretty simple setup in NHibernate. (I'm using Fluent
This is a seemingly simple problem but I am having trouble doing it in
I'm having a problem with java sessions. I'm developing a simple web app, where
I am having a problem where, after performing a simple mathematical operation on the
I am having a problem with GameQuery (jQuery) collision detection Tthey just never seem

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.