2

i would like to load (or be visible) an HTML/ASP.NET email form after the user clicked in a link/button. I have used this code but it doesn't work:

<script type="text/javascript">
    $(document).ready(function () {
        $("#imgMail").click(function (htm) {
            $.get("mailform.html"),
                $("#mailForm").append(htm)); //i have tryed also with .html() function.
        });
    });
</script>

where #imgMail is the ID of the link/button and the #mailForm is the ID of the DIV element into load the content.

How can i resolve this problem? P.S. The elements are not into a form tag.

Thanks.

3
  • I have used also the @Ajax.ActionLink() method of ASP.NET MVC but it doesn't load content into DIV but load directly the html page as a "postback event", in a new window. Commented Sep 25, 2012 at 10:41
  • 1
    For starters, you could take a look at the examples at api.jquery.com/jQuery.get Commented Sep 25, 2012 at 10:42
  • @jhonraymos: Excuse me for my bad English, but it isn't my first language. I'm a student, i'm learning :-) Commented Sep 25, 2012 at 10:54

1 Answer 1

7

Use this..

<script type="text/javascript">
    $(document).ready(function () {
        $("#imgMail").click(function() {
            $.get("mailform.html",function(data){
                $("#mailForm").append(data);
            });
        });
    });
</script>
Sign up to request clarification or add additional context in comments.

4 Comments

I posted the same answer - for some reason I didn't get the notification (again)... no intention
I already solved, thanks anyway. I have forgot function(htm) after get. Error of distraction :-)
@fpellegrino if it works than click on the right mark below the votes
I have clicked however I already solved. I have forgot function(htm) after get. Error of distraction. However thanks anyway :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.