We help IT Professionals succeed at work.

How to call an external httphandler using Jquery

Here's my situation
I have a customer facing website that show's customer information. I would like to get the user id (through a handler) using a jquery call so that i can capture that information for web analytics. the javascript file does not belong to the same project as the customer. in the traditional examples, i have seen where the request to a handler takes place within the same project. however in my situation i want to know how can i call the handler outside of the project. I have attached the code that i am currently using. everytime the return is 'undefined'
Any quick response would be very much appreciated.
function getGUID(customerurl) {
    var handler = "http://" + customerurl + '/userguidhandler.ashx?callback=?';
    $.getJSON(handler, function (getData) {
        return getData;
    });

Open in new window

Comment
Watch Question

hi

The focus of this article will be to use jQuery in an ASP.NET application and make calls to Http Handler classes. These classes will have ASHX extensions which are already mapped in IIS for a custom Http Handler implementation.

http://sites.google.com/site/spyderhoodcommunity/tech-stuff/usingjqueryinaspnetappswithhttphandlersashx
Top Expert 2009

Author

Commented:
Thanks for your help. Here's our how I resolved the issue
. http://www.ibm.com/developerworks/library/wa-aj-jsonp1/