1. #21
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,120
    Vote Rating
    30
    Answers
    85
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    1) Maybe not post a bug yet, wait until other users come up with this problem. Probably writer: 'json' works if you send data from the model. Bugs you can post on the Bug thread.

    2) You're right it is not anymore in the documentation, but people left some comments about it in the API.

    3) People mark their own answers all the time. Mark the post you think is the best answer to the problem you posted. If this is marked people will know it is solved, so mark something.

  2. #22
    Sencha User
    Join Date
    Nov 2011
    Posts
    16
    Vote Rating
    0
    Answers
    1
    michaelreneer is on a distinguished road

      0  

    Default


    Quote Originally Posted by tvanzoelen View Post
    1) Probably writer: 'json' works if you send data from the model.
    In the spirit of testing stuff out I gave this a try and was not successful.

    I will search the bugs forum to see if I can find something relating to this. It's difficult because I am not quite sure if I am using the object incorrectly, if there are some undocumented properties I am not utilizing or if there actually is a bug .

  3. #23
    Sencha User
    Join Date
    Jul 2012
    Location
    Coimbatore,TN,INDIA
    Posts
    56
    Vote Rating
    0
    thilakmsc is on a distinguished road

      0  

    Default


    Here my code i don't what's wrong in that.

    buttons: [{text:'Login',handler : function() {
    Ext.Ajax.request
    ({
    url:
    'Default.aspx?type=Login',
    method:
    'POST',
    params:
    {
    action:
    'new',
    //modify date
    Name:'thilak'
    },
    waitMsg:
    'Saving Data...',
    success:
    function(response)
    {
    var s = response.responseText;
    var respon = response.responseText;
    if(respon==1)
    {
    Ext.MessageBox.hide();
    Ext.MessageBox.alert(
    'Status','Logged In Successfully');
    window.location =
    'Login.php';
    }
    else
    {
    Ext.MessageBox.hide();
    Ext.MessageBox.alert(
    'Status','Log In Failed!');
    }
    }
    });
    }
    }, {text:
    'Reset'}]});

    C# Code :

    string action = Request.QueryString["type"];if (action != string.Empty)
    switch (action)
    {
    case"Login":
    Response.ContentType =
    "text/html";
    Response.Write(1);
    break;
    }


    But in the i get a Response like :

    1

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>
    Untitled Page
    </title><link href="ExtJS/resources/css/ext-all.css" rel="stylesheet" type="text/css" /></head>
    <body>
    <form name="form1" method="post" action="Default.aspx?type=Login" id="form1">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0MDkxNzYwNDNkZMqODl+2ksqIiQHUa9wayQUUyTs9" />
    </div>

    <div>

    <script type="text/javascript" language="javascript" src="ExtJS/adapter/ext/ext-base.js"></script>

    <script type="text/javascript" language="javascript" src="ExtJS/ext-all.js"></script>

    <script type="text/javascript" language="javascript" src="Scripts/default.js"></script>


    </div>
    </form>
    </body>
    </html>


    Help :

    I need to get only one(1) as result





  4. #24
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,120
    Vote Rating
    30
    Answers
    85
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    I created json handlers for that. Default.aspx returns viewstate and other stuff. In that case you must create a new aspx file and strip all its output.

    Or you can do something like this

    Create a AjaxHandler.cs

    Code:
    public class AjaxHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
    { 
    
        public AjaxHandler()
        {
           
        }
    
        HttpRequest request;
        HttpResponse response;
        HttpContext context;
        
        public void ProcessRequest(HttpContext context)
        {
            this.request = context.Request;
            this.response = context.Response;
            this.context = context;
            
            //In .xml is requested. A file with that extension
            //Does not need to exist.
            
            //Content type of the output stream. Extjs dataStores Xmlreaders require the contenttype text/xml 
            //Response.ContentType = "application/x-json";
            response.ContentType = "text/javascript";
    
            //write response here
    
        }
    
    
        public bool IsReusable
        {
            // To enable pooling, return true here.
            // This keeps the handler in memory.
            get { return false; }
        } 
       
      }
    And register it in the webconfig in the httpHandler section

    Code:
    <add path="*.jx" verb="*" type="AjaxHandler"/>
    In that way the handler will catch all the jx extentions. In the Ajaxt.Request you set the url like yourservice.jx

    You could use an other extention as well