[SOLVED]
The way to do it is, we can send the array as an JSON String using *stringify
*method.
index.jag contains
-------------------------------------------------
<script type="text/javascript">
function myFunction()
{
var itmArr=new Array();
if(document.getElementById("gtt").checked==true){
itmArr.push("HHHHHH");itmArr.push("HHHHHH333");
}
document.write(itmArr.length);
$.get("addOrder.jag", {arr: JSON.stringify(itmArr),action: "add"},//send
the array as a JSON String
function(data){
document.write(data);
});
}
</script>
addOrder.jag contains
------------------------------------------------
<%
var log=new Log();
if(request.getParameter("action")== "add"){
log.info('Request');
var x=parse(request.getParameter('arr')); // parse the json array
and assign it to x
print(x[0]); // can access the elements by its index
}
%>
specially thanks for helping-Sameera Medagammadda
On Thu, Dec 19, 2013 at 10:02 AM, Nadeeshaan Gunasinghe <[email protected]
> wrote:
> I have a simple application in which I send an array of elements from my
> index page to another jaggery script. Now I want to print those elements
> from the jaggary script
>
> My Index.jag contains
> -------------------------------
> $.get("addOrder.jag", {arr:itmArr,action: "add"},
> function(data){
> document.write(data);
> });
>
> --------------------------------
>
> My addOrder.jag
> ---------------------------------
> if(request.getParameter("action")== "add"){
>
> //This is where I need to add the print statement.
>
> }
> -----------------------------------
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev