Hi
@Milinda : This code is fully written inside a jaggery tag.

@Akila : put print statement after the definition of the function as below.

<%

Var id = 8605;




var startTask = function (id){



                           var version = new ws.WSRequest();

                           var options = new Array();

                           options.useSOAP = 1.2;

                           options.action = "urn : start";

                           var cookie=session.get('cookie');



                           options["HTTPHeaders"] = [

                                                         { name : "Cookie",
value :cookie },

                                                   ];



                           var payload =
'<ns:start><ns:identifier>'+id+'</ns:identifier></ns:start>';

                           var result;

                           var endpoint= "
https://192.168.255.150:9443/services/HumanTaskClientAPIAdmin/";;



                           try {

                           //response.addHeader('Cookie', cookie);

                           version.open(options,endpoint, false);

                           version.send(payload);

                           result = version.responseXML;

                           print('<script>alert('+result+');</script>');

                           } catch (e) {

                                                log.error(e.toString());

                                                //session.put("showLogin",
"true");

                                                print(e);

                                                //return null;

                                                }

                           };


Print(‘<button onclick="startTask(id)">Start</button>’);



%>

Thanks & Regards
Danushka Fernando
Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729


On Fri, Aug 1, 2014 at 12:57 PM, Milinda Perera <[email protected]> wrote:

> Hi Akila,
>
> Try this one:
> print('<button onclick="startTask('      +id       +' )">Start</button>')
>
>
> Or you can put like this outside the scripting segment (<%%>)
>
> <button onclick="startTask(<%=id%>)">Start</button>
>
> Thanks,
> Milinda
>
>
>
> On Fri, Aug 1, 2014 at 12:36 PM, Akila Nimantha [IT/EKO/LOITS] <
> [email protected]> wrote:
>
>>  Hi all,
>>
>>
>>
>> Im in a little trouble calling a jaggery function through html button
>> “onclick” event.
>>
>> When I click on the button my browser firebug console says , “ReferenceError:
>> startTask is not defined”.
>>
>>
>>
>> What I did was,
>>
>>
>>
>> <%
>>
>> Var id = 8605;
>>
>> Print(‘<button onclick="startTask(id)">Start</button>’);
>>
>>
>>
>> var startTask = function (id){
>>
>>
>>
>>                            var version = new ws.WSRequest();
>>
>>                            var options = new Array();
>>
>>                            options.useSOAP = 1.2;
>>
>>                            options.action = "urn : start";
>>
>>                            var cookie=session.get('cookie');
>>
>>
>>
>>                            options["HTTPHeaders"] = [
>>
>>                                                          { name :
>> "Cookie", value :cookie },
>>
>>                                                    ];
>>
>>
>>
>>                            var payload =
>> '<ns:start><ns:identifier>'+id+'</ns:identifier></ns:start>';
>>
>>                            var result;
>>
>>                            var endpoint= "
>> https://192.168.255.150:9443/services/HumanTaskClientAPIAdmin/";;
>>
>>
>>
>>                            try {
>>
>>                            //response.addHeader('Cookie', cookie);
>>
>>                            version.open(options,endpoint, false);
>>
>>                            version.send(payload);
>>
>>                            result = version.responseXML;
>>
>>                            print('<script>alert('+result+');</script>');
>>
>>                            } catch (e) {
>>
>>                                                 log.error(e.toString());
>>
>>
>> //session.put("showLogin", "true");
>>
>>                                                 print(e);
>>
>>                                                 //return null;
>>
>>                                                 }
>>
>>                            };
>>
>>
>>
>> %>
>>
>>
>>
>> Are there wrongs in my code…?
>>
>>
>>
>> Regards,
>>
>> Akila
>>
>>
>>
>> This message (including any attachments) is intended only for the use of
>> the individual or entity to which it is addressed and may contain
>> information that is non-public, proprietary, privileged, confidential, and
>> exempt from disclosure under applicable law or may constitute as attorney
>> work product. If you are not the intended recipient, you are hereby
>> notified that any use, dissemination, distribution, or copying of this
>> communication is strictly prohibited. If you have received this
>> communication in error, notify us immediately by telephone and (i) destroy
>> this message if a facsimile or (ii) delete this message immediately if this
>> is an electronic communication. Thank you.
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Milinda Perera
> Software Engineer;
> WSO2 Inc. http://wso2.com ,
> Mobile: (+94) 714 115 032
>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to