Home > Net >  How the.net MVC a pop-up window is added in the post action
How the.net MVC a pop-up window is added in the post action

Time:09-29

The following SingleRemove action:

 
[HttpPost]Public IActionResult SingleRemove (int id, string name)
{
Var singlecheese=_context. Cheeses. Single (c=& gt; C.I D==id);
_context. Cheeses. Remove (singlecheese);
_context. SaveChanges ();
The Content (" & lt; Script> The alter (' Remove the cheese successful ') & lt;/script>" );
Return RedirectToAction (" Index ", "Cheese");
}



After I want to delete a record in database to add a pop-up tip data deleted successful,

But with the Content (" & lt; Script> The alter (' Remove the cheese successful ') & lt;/script>" ); It actually doesn't work,
Under the search on the net, it USES jquery or AJAX, but don't know how to implement the concrete, and the great god, please give directions!
I am a beginner of small white ~

Specific code in the following link:
https://github.com/lvsezhufu/MVC

CodePudding user response:

[HttpPost]
Public IActionResult SingleRemove (int id, string name)
{
Var singlecheese=_context. Cheeses. Single (c=& gt; C.I D==id);
_context. Cheeses. Remove (singlecheese);
_context. SaveChanges ();
Return a json (" Remove the cheese successful ");
}
Ajax... Request...
Success: the function (RST) {
Alert (RST);
}

CodePudding user response:

Learn ajax, he can solve most of the questions you, all the MVC also with that for the asp to do what

CodePudding user response:

  • Related