Hi there,

I just tried your local code but I seem to be having problems with the
beforeSend event
var c = 1;

 $(".ic").cluetip(
                {
                    ajaxSettings: {
                        cache: true,
                        type: "POST",
                        data: "{username:'" + username + "', c:" + c +
"}",
                        contentType: "application/json;
charset=utf-8",
                        dataType: "json",
                        beforeSend: function(xhr) {
                            xhr.setRequestHeader("X-MicrosoftAjax",
"Delta=true");  <--- ERROR: setRequestHeader doesn't exist
                        }

                    },
                    ajaxProcess: function(data1) {
                        return data1.d;
                    }

.
.
.
.

The problem is that I have no access to the xhr object hence I get the
error:  "setRequestHeader" is not available, the only thing I have
access to is the cluetip itself. So how can I actually set a header by
overriding the beforeSend() method? The same problem will actually
happen with the error callback where we won't be able to tell the
status of xhr ie. xhr.status etc

Is it possible to have access to the the request object?

Regards DotnetShadow

On Apr 19, 12:19 pm, Karl Swedberg <k...@englishrules.com> wrote:
> Yes, absolutely. You can add your own function to any of the $.ajax  
> callback functions in the ajaxSettings option now. Your function will  
> be queued first for beforeSend, complete, and success, after which the  
> plugin's code will run. For error, however, yours will completely  
> override the default.
>
> --Karl
>
> ____________
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Apr 18, 2009, at 9:41 PM, DotnetShadow wrote:
>
>
>
> > Thanks for getting back to me,
>
> > You are correct I had to modify the script hence it was a temporary
> > fix, but now that I can use my own beforeSend() that makes it handy.
>
> > Does this mean the error callback can also be defined to the
> > ajaxSettings option?
> > The reason I ask is because sometimes you would like your application
> > to redirect to the login page if the forms authentication has expired
> > instead of having the message say "content could not be loaded..."
>
> > Thanks once again
> > DonetShadow
>
> > On Apr 18, 11:29 pm, Karl Swedberg <k...@englishrules.com> wrote:
> >> On Apr 17, 2009, at 11:50 PM, DotnetShadow wrote:
>
> >>> Thanks for that, I haven't tried it yet.
> >>> Does that mean we can now override the error and beforesend method?
> >>> What happens when there is a redirec? Your documentation hasn't been
> >>> updated, so not sure what the default behaviour is?
>
> >>> I actually temporarly solved it using this:
> >>> cluetip plugin - Need beforeSend() and error handling override
> >>>http://groups.google.com/group/jquery-en/browse_thread/thread/
> >>> 74ed458...
>
> >>> But I will have a go at your new implementation to see how it works
>
> >> I don't really see a solution in that post, other than to modify the
> >> plugin script itself, which, of course, isn't advisable. Am I missing
> >> something?
>
> >> if you pull down the most recent version from GitHub now, you can  
> >> just
> >> add your own beforeSend callbacks to the ajaxSettings option.
>
> >> --Karl
>
> >> ____________
> >> Karl Swedbergwww.englishrules.comwww.learningjquery.com

Reply via email to