Fórum

Javascript/Ajax

Avinash Vutukuri, modificado 12 Anos atrás.

Javascript/Ajax

New Member Postagens: 18 Data de Entrada: 07/07/11 Postagens Recentes
Hello,

I have a portlet which contains a form with 5 fields. I have to create a dynamic drop down list where the options of one dropdown field are dependant on the other dropdown field. Can some one let me know how could this be acheived?


I have implemented it by using Javascript/ajax. I have another "jsp" containing the code to communicate with the database and fetch the data which is called Onchangeof the 1st dropdown. But this jsp is not being invoked. Can some one let me know how can this be resolved??


Thank You,
Avinash.
Kavita Gupta, modificado 12 Anos atrás.

RE: Javascript/Ajax

Junior Member Postagens: 64 Data de Entrada: 12/03/08 Postagens Recentes
Hi Avinash,

Hope below code will help


Jquery:

<script type="text/javascript" language="javascript">
    $(document).ready(function(){
        $("#testLink").click(function(){
            $.post('<%=request.getContextPath()%>/selectOption.jsp', {}, function(data){
                $("#infoValue").html(data);
            })
        });
    });

</script>


Html :
<div id="mainDetails">
    <a href="#" id="testLink">Get Value</a>
    <span id="infoValue"></span>
</div>
thumbnail
Ravi Kumar Gupta, modificado 12 Anos atrás.

RE: Javascript/Ajax

Liferay Legend Postagens: 1302 Data de Entrada: 24/06/09 Postagens Recentes
I would suggest you to go with either serveResource method or using processAction but with Exclusive mode of portlet. You should be able to get both examples here http://sourceforge.net/projects/ajaxjqueryportl/files/
thumbnail
Sagar A Vyas, modificado 12 Anos atrás.

RE: Javascript/Ajax

Liferay Master Postagens: 679 Data de Entrada: 17/04/09 Postagens Recentes
Hi Avinash,

For simple understanding you can refer this also : http://www.excession.org.uk/blog/liferay-and-ajax.html

Thanks,
Sagar Vyas
thumbnail
Jignesh Vachhani, modificado 12 Anos atrás.

RE: Javascript/Ajax

Liferay Master Postagens: 803 Data de Entrada: 10/03/08 Postagens Recentes
Hi Avinash,
you can check this url http://liferaycms.blogspot.com/2011/06/ajax-call-using-jquery-in-liferay.html
Hope this will be usefull