Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- public myData test(myData m)
- {
- return m;
- }
- public class myData
- {
- public int Id { get; set; }
- public string Name { get; set; }
- }
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
- </head>
- <body>
- <script>
- var model = {
- Name: "Shyju",
- Id: 123
- };
- $.ajax({
- type: "POST",
- data: model,
- url: "http://localhost:52884/api/contact",
- }).done(function(res) {
- console.debug(res);
- // Do something with the result :)
- });
- </script>
- </body>
- </html>
- Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:52884/api/contact. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement