jQuery ajax with liferay

Tauseef Ahmed
Tauseef Ahmed
Less Than a Minute Read

On click on confirm ajax submit this form, and wherever your redirect in your class the ajax will redirect just the portlet.

<portlet:actionURL var="ajaxURL" name="atsglobaltechsoft" windowState="< %= LiferayWindowState.EXCLUSIVE.toString()%>" />

<script type="text/javascript" >
    function submitForm(){
        jQuery.ajax({
          type: 'POST',
          url: '<%= ajaxURL % >',
          success: function(data){
              jQuery('#p_p_id<portlet:namespace/ > .portlet-content').html(data);
          }
        });
    }
</script >


<form action="" name="fm" id="fm" method="post">
    <a href="#" onclick="submitForm();">confirm < /a>
</form>


 

Page Comments
Very useful post Tauseef. Thanks for sharing.

Ahamed Hasan
Author, Liferay Cookbook
Hey Tauseef, can you let us know what this code is doing? It will be helpful for beginners to better understand the usefulness of this.
On click on confirm ajax submit this form, and wherever your redirect in your class the ajax will redirect just the portlet, not your whole page so nothing changes on the backend.
Hello,

What if I want to call a Java function to store some form data in my database instead of doing it by javascript?

Thank you!

The Technicalities of Static Sites

David Oliveira Montenegro
View Blog >

Customization is Dead! Long Live Customization!

David H Nebinger
View Blog >
customization banner image.png

Public Bug Bounty Program

David H Nebinger
View Blog >
bugbounty.png
Showing 1 to 3 of 3 entries.