Submit form using jquery

Below is the code which can be used to submit a form using jquery. Also it has facility to pass post data and redirect to other page.

<script language="javascript" src="/js/jquery-latest.js"></script>


<script language="javascript">

   function postData(){

  $.post('/search/searchScreen.jsp', {param: "2038932"}, function() { window.location.href = '/search/
searchScreen.jsp
' });
   }

</script>

Usage: <a href="javascript:postData()">Cllick here</a>

No comments:

Post a Comment