Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

antiforgerytoken mvc with ajax



        function DeletePersonel(id) {

                var data = new FormData();
                data.append("__RequestVerificationToken", "@HtmlHelper.GetAntiForgeryToken()");

                $.ajax({
                    type: 'POST',
                    url: '/Personel/Delete/' + id,
                    data: data,
                    cache: false,
                    processData: false,
                    contentType: false,
                    success: function (result) {

                    }
                });

        }
    

        public static class HtmlHelper
        {
            public static string GetAntiForgeryToken()
            {
                System.Text.RegularExpressions.Match value = System.Text.RegularExpressions.Regex.Match(System.Web.Helpers.AntiForgery.GetHtml().ToString(), "(?:value=")(.*)(?:")");
                if (value.Success)
                {
                    return value.Groups[1].Value;
                }
                return "";
            }
        }
Comment

PREVIOUS NEXT
Code Example
Javascript :: useLocation 
Javascript :: js get english alphabet 
Javascript :: popover on show event 
Javascript :: nodejs select in mysql 
Javascript :: discord.js start 
Javascript :: request entity too large express 
Javascript :: js array.prototype.join 
Javascript :: javascript array to string with comma 
Javascript :: javascript random int 
Javascript :: find common characters in two strings javascript 
Javascript :: install php7 runtime brackets 
Javascript :: jquery add option if not exist 
Javascript :: jquery console log 
Javascript :: how to find out most repeated string in an array js 
Javascript :: js rock paper scissors 
Javascript :: how to check string uppercase or lowersace using regex javascript 
Javascript :: type svg react 
Javascript :: lifecycle state: defunct, not mounted 
Javascript :: change img src css 
Javascript :: send json body http get flutter 
Javascript :: material ui dark theme 
Javascript :: javascript data structures 
Javascript :: json parse returns object 
Javascript :: jquery each hover 
Javascript :: $push in mongoose 
Javascript :: define a class in javascript 
Javascript :: export multiple functions react 
Javascript :: ran ctrl c and npm server is still running 
Javascript :: javascript hide elements by class 
Javascript :: make random letter capital in string javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =