I am uploading a form with file and other inputs and all that is working fine. But the problem is that it is loading a new page i.e

www.mywebsite.com/controller/function. 

My code :-

<html>
<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script> 
<script src="http://malsup.github.com/jquery.form.js"></script> 

<script type="text/javascript">
    $(document).ready(function() {
        var options = { 
            clearForm: true,
            resetForm: true
        };
        // bind 'myForm' and provide a simple callback function 
        $('#myForm').ajaxForm(function() { 
            //alert("Thank you for your comment!"); 

        }); 
        $('#myForm').ajaxForm(options);

    }); 
</script> 

</head>

<body>
<form id="myForm" name="myForm" action="/main/comment" method="post"         enctype="multipart/form-data"> 
    <input type="text" name="name" />
    <br /> 
    <textarea name="comment">
Member Avatar for LastMitch

But the problem is that it is loading a new page i.e

Upload where? Where do you want to upload the page? On your <form> action is:

action="/main/comment"

you have to submit to a file that contain the path to your page that you want it to upload to.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.