1

I want a C# function to be called from my javascript function so that it should not redirect to another view

This is my HelpMe fucntion

public void HelpMe(Guid helpId)
    {
        ///help entry in the database
    }

how can I achieve this,

Don't know from where to start.

Usman
  • 2,547
  • 31
  • 35
  • 1
    It looks like a fundamental misunderstanding of HTTP. Using a browser you don't "call functions", you visit pages. Every click performs a new request, and shows the result to the user in the form of the page retrieved from the server. You can however make requests in the background, using JavaScript. It's called AJAX. You can then keep showing the same page. This is explained in [this duplicate](http://stackoverflow.com/questions/25528667/asp-net-mvc-execute-controller-action-without-redirecting). – CodeCaster Dec 14 '15 at 09:42
  • kindly post it here as an answer as well – Usman Dec 14 '15 at 09:47
  • No problem, happy to help. The principle is explained in the duplicate, if you have any trouble implementing it then read [ask] and edit your question into a [mcve]. – CodeCaster Dec 14 '15 at 09:48
  • I have modified question, here i need little help how i will be able to achieve my task. – Usman Dec 14 '15 at 09:57
  • Yeah no that edit made it worse. Google "AJAX call MVC controller" and start working from there. – CodeCaster Dec 14 '15 at 09:57
  • thanks for your time, got your idea. – Usman Dec 14 '15 at 10:00

0 Answers0