Hello, I have a scenario i'm trying to understand so I can implement it in my jquery code.
I have a series of jquery ajax calls that use this function:
I use this function to async load multiple components in my ui. When I have a success everythings work perfectly because the response contains all the data I need. But, when "error" is triggered I run into a problem because it does not return any of the original data. I need the original data in order to associate the ajax call to a specific component in my ui.Code:callService = function(url,data){ var request = $.ajax({ url: url, data: data, dataType: "jsonp", jsonp : "callback", jsonpCallback: "jsoncallback", error:function (xhr, ajaxOptions, thrownError){ console.log(xhr); DisplayError({error:thrownError, data}); } }); };
I found the pipe function in jquerys documentation and i'm trying to understand how to use it. What I would like to do is 'pipe' the data variable used in the ajax request into the error function. I'm a little confused on the syntax to do this and would appreciate some help or suggestions for better approaches.
Thanks for your help.



Reply With Quote


Bookmarks