fale is a JSON valid result, I would return undefined that in JSON should
never exist as case.
It's not the first time I return true or false from the server, and a false
positive like false (sorry for the concept) will mess up a lot of requestes
without a reason.
On Sun, Nov 2, 2008 at 6:21 PM, Rick Strahl <[EMAIL PROTECTED]> wrote:
>
> Wouldn't it be better to return the Exception object (or something
> that you can test for anyway)?
>
> Otherwise I'd argue that the exception thrown by a failed eval is a
> better choice than returning false.
>
> +++ Rick ---
>
>
> On Oct 31, 3:22 pm, Rob Manson <[EMAIL PROTECTED]>
> wrote:
> > Hi,
> >
> > not sure if you're happy for patches to be posted directly here...so
> > feel free to tell me where to patch it 8)
> >
> > roBman
> >
> > BUG:
> > httpData: function in ajax.js (used by getJSON() calls or get() calls
> > where type == "json") doesn't currently test the eval is successful.
> >
> > e.g. it just assumes that valid JSON was returned and eval will succeed,
> > silently failing if this is the case.
> >
> > FIX:
> > Here's a patch to bring it in line with the other functions above.
> >
> > e.g. httpSuccess and httpNotModified
> >
> > NOTE: Let me know if there's a more "preferred" way to handle this error
> >
> > DIFF against 1.2.6 from svn:
> > Index: src/ajax.js
> > ===================================================================
> > --- src/ajax.js (revision 5918)
> > +++ src/ajax.js (working copy)
> > @@ -478,9 +478,12 @@
> >
> > // Get the JavaScript object, if JSON is used.
> > if ( type == "json" )
> > - data = eval("(" + data + ")");
> > -
> > - return data;
> > + // Check to make sure the JSON returned evaluates
> correctly
> > + try {
> > + data = eval("(" + data + ")");
> > + return data;
> > + } catch(e) {}
> > + return false;
> > },
> >
> > // Serialize an array of form elements or a set of
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---