So here is the thing its been days since im trying to solve this, i'm debuggin a project from the company i work, its a web system, and here is the thing i have a javascript file which im going to call 'docart.js' and a core file which i will call 'operationscart.cs' so that i need to do is call the following function from the docart.js file for example

docart.js
file located like so: web/domain/models/docart.js

app.viewModel.doCart = {

this.AddCharge = function(id,pad){

//code is in here
}


}

So what i want to perform is from the class operationcart.cs i want to be able to call that .js function example

location: Core/Domain/Actions/operationcart.cs

private void PrepareCheckout {

//call to js function goes here

}

thanks in advance if someones knows how to solve my problem

If you've ASP.NET MVC project then 'PrepareCheckout()' should be an action method and you can request via jQuery.ajax. If not then create AJAX Service component, add PrepareCheckout method in it and request it via jQuery.ajax function.

you can do something like this

Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","MyFunction()",true);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.