How to use jQuery form plugin in ASP.NET Webform?

I came across this plugin: http://malsup.com/jquery/form/#getting-started

I was wondering how can I use this in asp.net web formats? What can I replace action="comment.php"

with? WebMethod?

ASPX:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script> 
<script type="text/javascript">
    $(document).ready(function () {
        // bind 'myForm' and provide a simple callback function 
        $('frmMaster').ajaxForm(function () {
            alert("Thank you for your comment!");
        });
    }); 
</script>

     <form id="myForm" action="Default.aspx/UPLOAD" method="post"> 
    Name: <input type="text" name="name" /> 
    Comment: <textarea name="comment"></textarea> 
    <input type="submit" value="Submit Comment" /> 
</form>
 </asp:Content>

      

CODE BEHIND:

[WebMethod]
    public string UPLOAD(HttpContext context)
    {

        return "test";
    }

      

NOTE. I am using masterpage.

+3


source to share





All Articles