I am doing a .NET project and faced with a problem that I need to connect a c# method to a javascript script
//more detail
I need to put javascript variables with data in a c# method and call method in javascript
Thanks in advance
I am doing a .NET project and faced with a problem that I need to connect a c# method to a javascript script
//more detail
I need to put javascript variables with data in a c# method and call method in javascript
Thanks in advance
 
    
    Asynchronous JavaScript And XML (AJAX)
To connect JavaScript and C# code you need to use AJAX this is where in JavaScript you write a piece of code which will send a Request to the C# Server. For the AJAX Request you will tell it multiple things such as
Example in JQuery
$.ajax({
        url: url,
        type: 'post',
        data: data,
        success: function (data) {
            //Some code here
        },
        error: function (request, status, error) {
            //If theres data request do this instead
        }
    });
A link to the AJAX Documentation https://api.jquery.com/jquery.ajax/
Hope this helps