Get Answer from server using a Handler

I am using a Handler for run server code, from the browser i can see the answer from the server, but i can not get it in my source.

I am calling the handler like that:

           $.ajax({
            type : "json",
            url : "../Handlers/Handler.ashx?MethodName=ReadAnswerServerID",
            success : function(data){
                alert('inside success');
            }
        });

I can get the answer inside the success block, but i never canĀ“t see the alert for example.

This is the handler:

    public void ProcessRequest(HttpContext context)
    {
        string method = context.Request.QueryString["MethodName"].ToString();
        context.Response.ContentType = "application/json";
        switch (method)
        {
            case "ReadAnswerServerID":
                context.Response.Write(ReadID());
                break;
        }
    }

ReadID return a string value.

Answers


I'm assuming "ReadID()" returns valid JSON, if not that might be your problem.

You can set a breakpoint inside ProcessRequest, attach to w3wp and hit the breakpoint when your Javascript call executes ?

If not, have you checked your handler registration in web.config ?


Need Your Help

How should I refactor my class?

php oop refactoring class-design

Basically I have a class that sends a SOAP request for room information receives a response, it can only handle one room at a time.. eg:

SSDT unresolved reference with dacpac references

visual-studio-2013 sql-server-2012 sql-server-data-tools

I have an SSDT project where I recently changed from SQL 2008 to SQL 2012. I re-exported my references DACPAC files using the SQL 2012 SqlPackage and replaced the SQL 2008 DACPACs with the new 2012