Thats cool, but why not increase flexibility if it is something that makes sense? And another thing that should be discussed is the request.HTML sometime you dont need all of its functions, some times you just need the response text and the javascript for example... i thought that there could be options to set what response you want to get... ust some thoughts...
Fábio Miranda Costa Engenheiro de Computação http://meiocodigo.com On Sun, May 24, 2009 at 9:03 PM, Aaron Newton <[email protected]> wrote: > > Catching poorly formatted JSON would require parsing the JSON string > before evaluating it, which means basically making a JS parser for > MooTools, which I think is overkill. It's your job to return well > formatted JSON. > > As for when scripts are evaluated (which started this thread), the > best way to do this is to set evalScripts to false, then add your > onSuccess logic as an event and call $exec(javascript) like so: > > var r = new Requst.HTML({ > ...various options... > evalScripts: false, > onSuccess: function(tree, elements, html, js) { > ...your operations > $exec(js); > } > }); > > On May 23, 6:35 am, fabiomcosta <[email protected]> wrote: > > Thierry, > > > > i think its impossible to catch the error on the script evaluation > > because of the current method of evaluating globally the scripts. > > But maybe someone has a solution... > > > > On May 22, 3:46 pm, Fábio Costa <[email protected]> wrote: > > > > > Could be really useful too! > > > And i think that the onException is not that useful, i would like to > know if > > > anybody have ever used it... > > > I mean, its your headers, you are setting them... why should they > return > > > errors? > > > I don't see why i need this but if someone have ever used or needed it > > > please report... > > > > > Fábio Miranda Costa > > > Engenheiro de Computaçãohttp://meiocodigo.com > > > > > On Fri, May 22, 2009 at 3:14 PM, Thierry bela nanga <[email protected] > >wrote: > > > > > > exactly, > > > > if an error occur, there is not really a way to handle it. > > > > > > 2009/5/22 Fábio Costa <[email protected]> > > > > > >> You mean like when the evaluation of the response gets an error, > right? > > > > > >> Fábio Miranda Costa > > > >> Engenheiro de Computação > > > >>http://meiocodigo.com > > > > > >> On Fri, May 22, 2009 at 2:44 PM, Thierry bela nanga < > [email protected]>wrote: > > > > > >>> I want to be able to handle error when mootools evaluate the > response > > > >>> in Request.JSON.success, not only when the request is being done, > > > >>> oherwise the overlay remains on the page and the only thing to do > is to > > > >>> reload the page :( > > > > > >>> 2009/5/22 Fábio Costa <[email protected]> > > > > > >>>> But the onFailure is fired when an error occurs on the request, i > don't > > > >>>> get your point.... :S > > > > > >>>> Fábio Miranda Costa > > > >>>> Engenheiro de Computação > > > >>>>http://meiocodigo.com > > > > > >>>> On Fri, May 22, 2009 at 10:50 AM, Thierry bela nanga < > [email protected]>wrote: > > > > > >>>>> I'll add something to this, > > > >>>>> I'm using Request.JSON to send data, if the request uses POST, > then I > > > >>>>> recover the page with a blocking overlay that should be removed > at the end > > > >>>>> of the request. > > > > > >>>>> when en error occurs while evaluating the response in > > > >>>>> Request.JSON.success, I have no way to handle it and the user > only have to > > > >>>>> press F5 to get out of that situation > > > > > >>>>> I think propose the onFailure event should be fired there > > > > > >>>>> 2009/5/22 Fábio Costa <[email protected]> > > > > > >>>>> Don't you guys think that the scripts inside the HTML request > should > > > >>>>>> be evaluated after the onSuccess and onComplete events? > > > >>>>>> Im asking this because sometimes i need the HTML inside the > received > > > >>>>>> response to be inject in the DOM before actually evaluating the > script tags > > > >>>>>> into the response. > > > > > >>>>>> evalScripts could be a string like 'after' and 'before', and of > > > >>>>>> course, for backwards compatibility, if you put true it would > eval the > > > >>>>>> script before the onComplete and onSuccess events. > > > > > >>>>>> Fábio Miranda Costa > > > >>>>>> Engenheiro de Computação > > > >>>>>>http://meiocodigo.com > > > > > >>>>> -- > > > >>>>> fax : (+33) 08 26 51 94 51 > > > > > >>> -- > > > >>> fax : (+33) 08 26 51 94 51 > > > > > > -- > > > > fax : (+33) 08 26 51 94 51 > > > > >
