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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:18:31+00:00 2026-05-27T02:18:31+00:00

After $.ajax post request to the controllers action I would like to get info

  • 0

After $.ajax post request to the controllers action I would like to get info from the server and then update my partial view, for example I have a list rendered in my view I delete an item from the list using the $.ajax post request and then i would like my list to update itself asynchronously.

Here is my function that deletes the item from the list:

 $(".btnDeleteCurrentFavSong").click(function () {

    var songId = $(this).attr('name');

    $.ajax({
        type: 'POST',
        url: "/Home/DeleteCurrentFav/",
        data: { id: songId },
        success: ShowMsg("Song deleted successfully"),
        error: ShowMsg("There was an error therefore song could not be deleted, please try again"),
        dataType: "json"
    });
});

Should I somehow redirect to the action on ajax success that returns the list of songs to the view?

  • 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-27T02:18:31+00:00Added an answer on May 27, 2026 at 2:18 am

    if your clicked list item looked like this:

    <li name="120">Artist - Title</li>
    

    your javascript could look something like this:

    $(".btnDeleteCurrentFavSong").click(function () {
    
        var songId = $(this).attr('name');
    
        $.ajax({
            type: 'POST',
            url: "/Home/DeleteCurrentFav/",
            data: { id: songId },
            success: function () {
                ShowMsg("Song deleted successfully");
                $("li[name=" + songId + "]").remove();
            },
            error: ShowMsg("There was an error therefore song could not be deleted, please try again"),
            dataType: "json"
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am posting to the server using jquery ajax using $.post. After server returns
I am using this code if form.is_valid(): form.save() if request.POST.get('ajax') == 'true': return HttpResponse('Data
What I'm wanting to do is after I get the ajax request back that
I am fetching 2 div's from a page using $.post jQuery AJAX request. Now
how can i disable live('click', function...) method and then after ajax call (depending on
I have a table which is updated with ajax and after update it if
I have a situation where I send jquery ajax post request but in my
My lightview modal keeps closing after an Ajax request. Meaning when I make an
I'm doing user auth via an Ajax post-request in Rails, and I thought that
I would like to use jQuery to refresh a partial on a page, but

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.