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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:51:21+00:00 2026-06-06T20:51:21+00:00

I have a DeleteUser function that gets called when user clicks on the delete

  • 0

I have a DeleteUser function that gets called when user clicks on the delete row icon in an actioncolum.
Here is the code for the function:

function DeleteUser(id) { 
Ext.Ajax.request ({
url: 'user/delete/castle',
params: {id: id},
success: function (result,request){
Ext.MessageBox.alert('Success', result.responseText);
},
failure: function (result, request){
alert(result.responseText);
}
});
}

Right now, when a user is deleted, a pop-up appears with the title “Success” but the result.responseText parameter is empty.
I need the result.responseText parameter to be “User deleted successfully” but I need to pass that by using RenderText in the delete function that gets called via the url.
Here is the code for the delete function that gets called via the url ‘user/delete/castle’:

public void Delete (int id){
CancelView();
CancelLayout();
User user = User.FindUser(id);
user.Delete();
RenderText(JsonConvert.SerializeObject(???));
}

Does anyone have any tips as to how to do this? I am new to Ajax requests and JSON.

Thanks for the help.

  • 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-06T20:51:23+00:00Added an answer on June 6, 2026 at 8:51 pm

    You have to return a JSON object like

    { success = true, message = 'Your message'}
    

    to client.
    Here is the way to do it:

    Server code:

    var obj = new {success = true, message = "Your success message"}
    RenderText(JsonConvert.SerializeObject(obj));
    

    To notify a failure you can set success = false in above code.

    Client code:

    function DeleteUser(id) { 
    Ext.Ajax.request ({
    url: 'user/delete/castle',
    params: {id: id},
    success: function (response) {
                    var resp = Ext.decode(response.responseText);
                    alert(resp.message); 
                    if (success == false)
                    {
                       // perform any specific error handling task
                    }                    
                },
    failure: function (result, request){
         // Usually this function is called on communication failures. Not called if success = false
         alert(result.responseText);
    
    }
    });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a delete user link in a normal Activerecord table, but
I have a gridview control with delete asp:ImageButton for each row of the grid.
I have a similar problem with delete command too.. function deleteUsers($userID) { foreach($userID as
I have problems regarding with pagination and Ajax form. Here is my code for
I have an enum called Permissions. A user can be assigned permissions, or permissions
List_of_subject = ['add user', 'modify user', delete user'] and so on I have a
I have an Entity called User. User should be used in multilingual environment So
I'm using jQuery UI dialog. I have a delete form as follows: @using (Ajax.BeginForm(DeleteUser,
I have created a DLL that contains lots of authentication and user management that
I have three tables that I am working with User, Application, ApplicationAdministrator. ApplicationAdministrator is

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.