Hi Harshan,

I think this way is much more convenient . Thank you

Regards,
Damith.

On Sun, Oct 19, 2014 at 11:21 AM, Harshan Liyanage <[email protected]> wrote:

> Hi Damith,
>
> That way is also ok. But I think you can get the error in result.data.
> Please check the following code.
>
> var result = post(url, {}, {},'json);
> result = parse(result.data);
> //Now check for error
> if (result.error) {
> //do the error handling
> }else{
> }
>
> Thanks,
>
> Best Regards,
>
> Lakshitha Harshan
> Software Engineer
> Mobile: *+94724423048*
> Email: [email protected]
> Blog : http://harshanliyanage.blogspot.com/
> *WSO2, Inc. :** wso2.com <http://wso2.com/>*
> lean.enterprise.middleware.
>
> On Fri, Oct 17, 2014 at 2:43 PM, Damith Wickramasinghe <[email protected]>
> wrote:
>
>> Hi Manoj,
>>
>> No i'm calling to a external resource in server side using jaggery POST
>> method to retrieve some attributes. As per the documentation On success
>> callback there is a success method. Is there a method to handle failure use
>> cases as well? As for now using following code i'm checking the status code
>> to verify whether its success or not.
>>
>>
>> var result = post(url, {
>>                 "code" : CODE,
>>                 "client_id" : C_ID,
>>                 "client_secret" : C_SEC,
>>                 "redirect_uri" : REDIRECT,
>>                 "grant_type" : TYPE,
>>             },
>>             {
>>                 "User-Agent" : "Jaggery-XHR",
>>                 "Country" : "LK"
>>             },  'json');
>>
>> var code=result.xhr.status;
>>
>>
>> Regards,
>> Damith.
>>
>> On Fri, Oct 17, 2014 at 1:51 PM, Manoj Gunawardena <[email protected]>
>> wrote:
>>
>>> Hi Damith,
>>>
>>> Not clear your requirement. Post into jag mean? Are you trying to call
>>> JAG APi from java script? Please share the client code and JAg code.
>>>
>>> Thanks
>>>
>>> On Thu, Oct 16, 2014 at 7:10 PM, Damith Wickramasinghe <[email protected]
>>> > wrote:
>>>
>>>> Hi,
>>>>
>>>> I have developed a Jaggery app to our training project and i needed to
>>>> do a Jaggery post and handle some error cases if the response fails. I went
>>>> through the documentation but i could not find a Post error method. So as
>>>> for a work around i checked the returned code using userInfo.xhr.status and
>>>> did the logic. I'm not sure whether its a good approach to do so. Can some
>>>> please tel me if there's a method to handle that.
>>>>
>>>> For success the method is,
>>>>
>>>> success(data:Object,
>>>> xhr:Object)
>>>>
>>>> as per the documentation.
>>>>
>>>> Regards,
>>>> Damith
>>>>
>>>> --
>>>> Software Engineer
>>>> WSO2 Inc.; http://wso2.com
>>>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
>>>> lean.enterprise.middleware
>>>>
>>>> mobile: *+94728671315 <%2B94728671315>*
>>>>
>>>>
>>>
>>>
>>> --
>>> Manoj Gunawardena
>>> Tech Lead
>>> WSO2, Inc.: http://wso2.com
>>> lean.enterprise.middleware
>>> Mobile : +94 77 2291643
>>>
>>
>>
>>
>> --
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
>> lean.enterprise.middleware
>>
>> mobile: *+94728671315 <%2B94728671315>*
>>
>>
>


-- 
Software Engineer
WSO2 Inc.; http://wso2.com
<http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
lean.enterprise.middleware

mobile: *+94728671315*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to