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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:28:16+00:00 2026-05-22T16:28:16+00:00

These are my two jQuery functions $(.enable_button).click(function(){ var server_name = $(this).attr(title); $.get(ajax/server_ajax.php?action=enable&server_name= + server_name),

  • 0

These are my two jQuery functions

$(".enable_button").click(function(){
    var server_name = $(this).attr("title");
    $.get("ajax/server_ajax.php?action=enable&server_name=" + server_name), function(data) {
        alert(data);
    }
});

$(".disable_button").click(function(){
    var server_name = $(this).attr("title");
    $.get("ajax/server_ajax.php?action=disable&server_name=" + server_name), function(data) {
        alert(data);
    }
});

Pretty easy to see what they do, on a button click they enable or disable a server by passing an action parameter and server_name parameter to ajax/server_ajax.php. Everthing works, but for some reason the data being returned is never being alert’d. I can verify that it is correctly requesting that PHP file and the PHP file is returning data, as I can see it in the “Response” tab of Firebug.

I’ve also tried replacing the alert with document.write(data) and that doesn’t work either.

Can anyone lend a hand? I’m clueless.

  • 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-22T16:28:16+00:00Added an answer on May 22, 2026 at 4:28 pm

    You’re closing the call to get() too early. The parenthesis after + server_name shouldn’t be there.

    $.get("ajax/server_ajax.php?action=disable&server_name=" + server_name), function(data) {
                                                                        //^The ) shouldn't be here
        alert(data);
    }
    

    should be

    $.get("ajax/server_ajax.php?action=disable&server_name=" + server_name, function(data) {
        alert(data);
    }); //<-- close the call to get( over here, not after server_name.
    

    Just an aside but with jQuery’s ajax functions, you have the ability to pass an object for the data and jQuery will create the query string out of it, neatly escaping anything requires it. So you might do this which is equivalent to your original call for disable:

    $.get("ajax/server_ajax.php", {"action" : "disable", "server_name" : server_name}, function(data) {
        alert(data);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Of these two, which is correct? jQuery('someclass').click(function() { alert(I've been clicked!); }); or jQuery('someclass').each().click(function()
I have these two functions: jQuery.fn.enterText = function(e){ if( $(#cursor).val() && e.keyCode != 32
So i have these two jquery functions which pass my XHR service a key
Consider these two function definitions: void foo() { } void foo(void) { } Is
I am just wondering what is the difference between these two File1.js $(function() {
What is the different in performance and the handling of these two different jQuery
I'm trying to add these two or more inputs in jquery, to give me
I have been testing the new deferred AJAX functions in jquery 1.5 and am
I have two jQuery Ajax calls that I'm combining on a page. I'm stuck
Does anyone know how to get the jQuery .load() function to work concurrently? Right

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.