How to disable submit action

Solution 1:

onclick="loadXMLDoc('file.xml'); return false;"

or even better:

<script>
    window.onload = function() { 
        document.getElementById("search-form").onsubmit = function() { 
            loadXMLDoc('file.xml');
            return false;
        };
    };
</script>

To implement loadXMLDoc, you can use the ajax module in jQuery. for example:

function loadXMLDoc() { 
    $("div").load("file.xml");
}

Final code using jQuery:

<script>
    $(function() { 
        $("#search-form").submit(function() { 
            $("div").load("file.xml");
            return false;
        });
    });
</script>

Solution 2:

I think you need ajax function to load data with in div without page reload

Change input type submit to button

<input type="button" value="Search" id="sButton" onclick="AjaxSend()" />

Ajax CAll:

<script type="text/javascript">
    function AjaxSend(){
         $.get('file.xml', function(data) {
              $('div').html(data);
          });
     }
</script>

Solution 3:

use prevent defaults to avoid form action.please refer the code below it might help you

function createRecord(){	
	event.preventDefault();
	
}
<form>

<input type="text"/>
<input type="submit" onclick="createRecord()"/>

</form>