Click here to Skip to main content
15,887,325 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
This is My Ajax Call

JavaScript
function SelectDocument(DocId) {
        $.ajax({
            url: $("#DocReCall").val(),
            data: { id: DocId },
           
        });
}


This is the Action
C#
public ActionResult DocumentReCall(int id)
{
  DocumentsViewModel objViewModel = new DocumentsViewModel();
  {
  // Set Data To View Model
  }
return View("Documents", objViewModel);
}


What I have tried:

Change Documents to DocumentReCall But not Working

without any changes Successfully hit DocumentReCall Action but not set to data to page
not changing the url also

Any suggestion many Thank In Advance
Posted
Comments
F-ES Sitecore 31-May-18 5:05am    
You are calling the action but doing nothing with the result. How is the javascript meant to know what you want to do with the returning html? You need to use the success event (or whatever the equivalent is in whatever version of jquery you're using) to update an element in the DOM with the resulting view.

There is an example here https://www.w3schools.com/jquery/ajax_ajax.asp

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900