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

My application does not have access to my Oracle 11g database sequence

oracle11g

I have sucessfully connected to my database through JDBC (no sid or service specified): com.test.sql.url=jdbc:oracle:thin://@111.222.333.444:1521, but when my java program tries to insert a row tha...

jQuery .remove is not a function

javascript jquery

I've been bashing my head at this for a couple days.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.