简体   繁体   中英

how i use in c# form data send by ajax

I have written this javascript code:

$(document).ready(function(){
     $("form").submit(function(){
             var form = $("form").serialize();
             $.ajax({
                   type:"post",
                   url: "App_Code/data.cs/myFunction",
                   data:form,
                   datatype:"json",
                   success: function
           });
     });
});

How do I get the posted form data in the C# function?

You can't just call a function from the brower.

You need use with asp.net MVC. Your function has to be part of a controller, so you can call it from the client side.

You have here official documentation and here good tutorial in hebrew.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM