Hmm. That's odd.

Can you try it here?
http://plugins.learningjquery.com/cluetip/demo-more/xhr.html

In browsers with console.log, it'll print stuff to the console; in those without, it'll put it in alerts. Here is the script:

$('a').cluetip({
  ajaxCache: false,
  ajaxSettings: {
    beforeSend: function(xhr) {
      (window.console && console.log) ? console.log(xhr) : alert(xhr);
    },
    complete: function(xhr, textstatus) {
(window.console && console.log) ? console.log(textstatus) : alert(textstatus);
    }
  }
});



--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Apr 23, 2009, at 9:00 PM, DotnetShadow wrote:


Hi there,

I just tried your latest version and still this is not working.

beforeSend() doesn't even get invoked I tried a simple example:

$('foo').cluetip({
   ajaxSettings: {
     beforeSend: function(xhr) {
         alert("BeforeSend")              <-------------------
DOESN'T GET CALLED


     }
   }

It seems beforeSend doesn't even get invoked for some reason? I can't
even set headers or anything.

Regards DotnetShadow


On Apr 22, 3:15 pm, Karl Swedberg <kswedb...@gmail.com> wrote:
Sorry for the delay in getting back to you guys. My email was down all
day yesterday. Anyway, this should do it now

http://github.com/kswedberg/jquery-cluetip/tree/master

you should be able to do

$('foo').cluetip({
   ajaxSettings: {
     beforeSend: function(xhr) {
       // whatever
     },
     complete: function(xhr, textstatus) {
       // whatever
     }
   }

});

and so on.

--Karl
____________
Karl Swedbergwww.learningjquery.comwww.englishrules.com

On Apr 20, 2009, at 10:52 AM, DotnetShadow wrote:



I am having the exact same problem even with the latest code and like
yourself I have had to edit the plugin I've been having a similar
discussion here:

http://groups.google.com/group/jquery-en/browse_thread/thread/594721d ...

Regards DotnetShadow

On Apr 20, 11:51 pm, zendog74 <n8cs...@gmail.com> wrote:
Thanks Karl. So, does the latest version of clueTip support all of
the
ajax options? I had to modify the plug-in previously to support
sending some custom headers.

Also, the xhr option looks like it may work for what I am trying to
do, but I am not sure exactly how to use it. I don't really want to
override the xhr object... I just need access to it to get the http
status code. The server component I am calling will return various
status codes for various problems with the call (authentication,
missing params, etc...), so I need to be able to pull it out and
check
it.

On Apr 19, 2:05 pm, Karl Swedberg <k...@englishrules.com> wrote:

Since the plugin uses $.ajax(ajaxSettings) internally to retrieve
the
file contents, you can pass any options you want into the
ajaxSettings
option and they'll be used. So you should be able to do something
like
this:

$('someelement').cluetip({
   ajaxSettings: {
     xhr: function() { }
   }

});

Seehttp://docs.jquery.com/Ajax/jQuery.ajax#optionsforalist of
$.ajax options. Also, make sure you use jQuery 1.3 or above and the
latest clueTip version on Github 
(http://github.com/kswedberg/jquery-cluetip/tree/master
  )

--Karl

____________
Karl Swedbergwww.englishrules.comwww.learningjquery.com

On Apr 16, 2009, at 2:52 PM, zendog74 wrote:

I am successfully using clueTip to make ajax requests that return
either xml or json and populate the tooltips. It is working great.
However, I am trying to make my code more sophisticated to handle
exceptions and I need access to the xhr to do that properly. I have
been unable to find a way to get access to the xhr using clueTip,
especially in the ajaxProcess function. Is there a way to do this?

Here is what I am trying to do:

ajaxProcess: function(xhr, data) {
               return checkResponse(xhr.status, data);
           }

//Pseudo-code
function checkHttpStatusCode(statusCode, data){
 //Check the status code and send back the error message in the
returned xml packet if there is one.

}

Reply via email to