Beside telling people to use a string, the obvious solution would be
to call toString on whatever the function receives. I suppose it could
be possible to parse the result to see if it is a real string or not.

Does anyone know if something like this is cross browser:

var obj = {id: 1, name: 'Ted'};
if (obj.toString === Object.prototype.toString) {
    // toString() was not overwritten
}

On 8/27/07, John Resig <[EMAIL PROTECTED]> wrote:
>
> Yeah, that's pretty much exactly it. Not entirely sure how we're going
> to get around this - this issue has cropped up twice now, with Ajax.
>
> --John
>
> On 8/27/07, Theodore Ni <[EMAIL PROTECTED]> wrote:
> >
> > I have not looked at the code in depth, but I know that 1.1.4 supports
> > recursive $.extend(), which might look at the fields inside your
> > document.location object and return something the function was not
> > expecting.
> >
> > On 8/27/07, drew <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi all,
> > >
> > > I've been using $.ajax in jQuery 1.1.3 to make Ajax requests, and was
> > > using document.location to set the url to send the request to, like
> > > so:
> > >
> > > $.ajax({
> > >   url: document.location,
> > >   data: data,
> > >   dataType: 'json',
> > >   type: 'post',
> > >   success: function(response_data) {
> > >     // do something...
> > >   }
> > > });
> > >
> > > This method of setting the url worked fine for me under 1.1.3, even
> > > though I assume it is technically incorrect, because document.location
> > > returns a location object rather than a string. Upon updating to
> > > jQuery 1.1.4, the ajax requests still "worked" (the request succeeded,
> > > the callback was called, and did its thing), but after the request the
> > > page would reload. After much fiddling and confusion I changed
> > > document.location to document.location.toString() and things worked
> > > fine, as I would have expected them to.
> > >
> > > I don't know if this bug or not, but I didn't see anything in the
> > > changelog for 1.1.4 about this behavior and was wondering why this
> > > happened, and if it should be expected.
> > >
> > > Thanks,
> > > Drew
> > >
> > >
> >
>


-- 
Ted

Reply via email to